On Mon, Jul 7, 2008 at 7:04 AM, Fernando Rodríguez <[EMAIL PROTECTED]>
wrote:

>
> Hi,
>
> I followed the advice I got here, and added
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.admin
>
> to settings.py and included the following pattern to urlsp.py:
> (r'^admin/', include('django.contrib.admin.urls')),
>
> I also included
> from django.contrib.auth.models import User from
> django.contrib.contenttypes.models import ContentType
> in mymodels.py.
>
> BTW, I'm using the books example from "the definitve guide to
> django" (chapter 6).
>
> Whenever I try to access the admin app (localhost:8000/admin/) I get
> this error page:
>
>
> --------------------------------------------------------------------------------------------------------
> AttributeError at /admin/
> 'WSGIRequest' object has no attribute 'user'
>          Request Method:
> GET
>            Request URL:
> http://localhost:8000/admin/
>          Exception Type:
> AttributeError
>          Exception Value:
> 'WSGIRequest' object has no
> attribute 'user'
>        Exception Location:
> /var/lib/python-support/python2.5/django/contrib/admin/views/decorators.py
> in _checklogin, line 49
>
>
> Traceback (most recent call last):
> File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in
> get_response
>  77. response = callback(request, *callback_args, **callback_kwargs)
> File
> "/var/lib/python-support/python2.5/django/contrib/admin/views/decorators.py"
> in _checklogin
>  49. if request.user.is_authenticated() and request.user.is_staff:
>
>  AttributeError at /admin/
>  'WSGIRequest' object has no attribute 'user'
>
>
> -----------------------------------------------------------------------------------------------------------
>
> What am I STILL doing wrong?
>
> Thanks in advance!
>

Adding the user to the reequest object is done by the authentication
middleware:

http://www.djangoproject.com/documentation/middleware/#django-contrib-auth-middleware-authenticationmiddleware

so it sounds like you are missing at least that (and possibly the session
middleware) from your MIDDLEWARE_CLASSES spec in settings.py.

I find it surprising the book does not cover these things (though these
should have been there by default when you ran startproject, so maybe what I
find surprising is that they are not there already in your config).

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to