My favorites | Sign in
Project Logo
                
Search
for
Updated May 07, 2008 by Sean.B.OConnor
Labels: Featured
UserModel  
Documentation of the django-ae-utils Datastore based User Model

Using the django-ae-utils User Model

User Model API

Using User Model Generic Views

django-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:

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>

Comment by juanefren, Aug 20, 2008

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.

Comment by mengqc2008, Mar 06, 2009

I meet the same problem. This is my solution: step1:

copy django/contrib/sessions/middleware.py to django-ae-utils/sessions django/utils/http.py and django/utils/hashcompat.py to django-ae-utils/utils django/contrib/sessions/backends/base.py to django-ae-utils/sessions/backends/
step2:
modify "from django.utils.http import cookie_date" to
"from django_ae_utils.utils.http import cookie_date" in django-ae-utils/contrib/sessions/middleware.py
modify "from django.utils.hashcompat import md5_constructor" to
"from django_ae_utils.utils.hashcompat import md5_constructor" in django-ae-utils/sessions/backends/base.py
step3:
modify settings.py
MIDDLEWARE_CLASSES = (
'django_ae_utils.sessions.middleware.SessionMiddleware?',
) INSTALLED_APPS = (
'django_ae_utils.sessions',
) SESSION_ENGINE = 'django_ae_utils.sessions.backends.datastore'

and it worked


Sign in to add a comment
Hosted by Google Code