Using the django-ae-utils User Model- Add the django_ae_utils directory to your project directory or somewhere else along your PYTHON_PATH.
- Import the user model into your code with the following line:
from django_ae_utils.auth.models import User User Model API- Model attributes:
- email - The user's email address
- password - The user's hashed password. This should always be set using the set_password method.
- first_name - The user's first name
- last_name - The user's last name
- last_login - A datetime representation of the last time the user logged in
- created - A datatime representation of when the user registerd
- modified - A datetime representation of when the user was last modified
- Model methods:
- login (email, password, request) - Verifies the user's credentials against the database and updates the user's last logged in date. Request is an optional argument, if passed login will also store the User in Request.session'user'.
- authenticate (email, password) - Verifies the user's credentials against the datastore.
- set_password (password) - Accepts a clear-text password, hashes the password, and updates the user model.
Using User Model Generic Viewsdjango-ae-utils auth module includes three generic views: register, login, and logout. To use any of the generic views add an entry to your urls.py similar to: (r'^login/$', 'django_ae_utils.auth.views.login'), Additionally the django-ae-utils auth generic views can accept optional parameters to customize their behavior. The available parameters and their defaults are: - login - template="login.html", next_url="/"
- logout - next_url="/"
- register - template="register.html", next_url="/"
To set these parameters use a line in urls.py similar to: (r'^login/$', 'django_ae_utils.auth.views.login', {"template":"my_login.html", "next_url":"/login_success/"}),The "next_url" parameter can also be passed via a get or post variable named "next_url". If set, the GET or POST variable will take precedence over any value passed in from urls.py. Finally below are example templates for the login and register views: login.html<html>
<head>
<title>Login</title>
</head>
<body>
<h1>Login</h1>
{% if feedback %}
<div class="feedback">
{{ feedback }}
</div>
{% endif %}
<form action="{{ action_url }}" method="post">
<table class="login_form">
{{ form }}
</table>
<input type="submit" />
</form>
</body>
</html>register.html<html>
<head>
<title>Register</title>
</head>
<body>
<h1>Register</h1>
{% if feedback %}
<div class="feedback">
{{ feedback }}
</div>
{% endif %}
<form action="{{ action_url }}" method="post">
<table class="reg_form">
{{ form }}
</table>
<input type="submit" />
</form>
</body>
</html>
|
Thanks, I did all that, looks like working (valides Logins, and register users) but when do the work next it appears this error:
ImproperlyConfigured?: You haven't set the DATABASE_ENGINE setting yet.
I meet the same problem. This is my solution: step1:
step2: step3: MIDDLEWARE_CLASSES = ( ) INSTALLED_APPS = ( ) SESSION_ENGINE = 'django_ae_utils.sessions.backends.datastore'and it worked