you probably need to create an admin.py file in your application directory.
from: http://docs.djangoproject.com/en/dev/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin something like (...project/app/admin.py): from mysite.polls.models import Poll from django.contrib import admin admin.site.register(Poll) On Jan 4, 11:00 am, HB <hubaghd...@gmail.com> wrote: > Thanks it works now. > I got a page to manager Users, Groups and Sites > My purpose was to test Admin pages for my models. > Any ideas how to do that? > Forgive me again, I'm new to Django and I'm a little lost. > Thanks in advance. > > On Jan 4, 4:39 pm, Eric Abrahamsen <gir...@gmail.com> wrote: > > > On Jan 4, 2009, at 8:14 PM, HB wrote: > > > > Well, sorry but where to add those lines? > > > In your settings.py file. There might not be a MIDDLEWARE_CLASSES > > value at all at the moment (though I can't imagine where it went), so > > make sure there's something like this in settings: > > > MIDDLEWARE_CLASSES = > > ("django.contrib.sessions.middleware.SessionMiddleware", > > "django.contrib.auth.middleware.AuthenticationMiddleware", > > "django.middleware.common.CommonMiddleware", > > "django.middleware.doc.XViewMiddleware") > > > Give that a shot. > > > Eric > > > > On Jan 4, 2:11 pm, Eric Abrahamsen <gir...@gmail.com> wrote: > > >> On Jan 4, 2009, at 8:00 PM, HB wrote: > > > >>> Here is the full traceback: > > >>> +++ > > >>> Environment: > > > >>> Request Method: GET > > >>> Request URL:http://localhost:8000/admin/ > > >>> Django Version: 1.0.2 final > > >>> Python Version: 2.5.2 > > >>> Installed Applications: > > >>> ['django.contrib.auth', > > >>> 'django.contrib.contenttypes', > > >>> 'django.contrib.sessions', > > >>> 'django.contrib.sites', > > >>> 'django.contrib.admin', > > >>> 'djdrive.books'] > > >>> Installed Middleware: > > >>> () > > > >> You weren't kidding, you've got no middleware installed. The default > > >> values should be: > > > >> ("django.contrib.sessions.middleware.SessionMiddleware", > > >> "django.contrib.auth.middleware.AuthenticationMiddleware", > > >> "django.middleware.common.CommonMiddleware", > > >> "django.middleware.doc.XViewMiddleware") > > >> try that, and things might work. > > > >>> Traceback: > > >>> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" > > >>> in get_response > > >>> 86. response = callback(request, *callback_args, > > >>> **callback_kwargs) > > >>> File "/usr/lib/python2.5/site-packages/django/contrib/admin/ > > >>> sites.py" > > >>> in root > > >>> 140. if not self.has_permission(request): > > >>> File "/usr/lib/python2.5/site-packages/django/contrib/admin/ > > >>> sites.py" > > >>> in has_permission > > >>> 99. return request.user.is_authenticated() and > > >>> request.user.is_staff > > > >>> Exception Type: AttributeError at /admin/ > > >>> Exception Value: 'WSGIRequest' object has no attribute 'user' > > >>> +++ > > > >>> I'm new to Django and I'm reading "The Definitive Guide to Django" > > >>> which seems to me too out dated... > > > >> Yep, quite a lot has changed since that book was written... > > > >> Yours, > > >> Eric > > > >>> On Jan 4, 1:34 pm, Eric Abrahamsen <gir...@gmail.com> wrote: > > >>>> On Jan 4, 2009, at 7:19 PM, HB wrote: > > > >>>>> I don't have middleware classes. > > >>>>> I just created some model classes and tried to create Admin > > >>>>> application for them. > > >>>>> Maybe I have to comment some of INSTALLED_APPS that Django > > >>>>> uncomment > > >>>>> them by default. > > >>>>> Suspects are auth, contenttypes, sessions > > >>>>> Right? > > > >>>> Everybody's got middleware classes! But it sounds like you're > > >>>> probably > > >>>> running the defaults, which should be sufficient to make the admin > > >>>> work. And you'll need all those contrib apps in INSTALLED_APPS, so > > >>>> don't comment them out. Try posting the full traceback, and if that > > >>>> doesn't jog my memory we'll just see if someone else can jump in... > > > >>>> E > > > >>>>> On Jan 4, 1:06 pm, Eric Abrahamsen <gir...@gmail.com> wrote: > > >>>>>> On Jan 4, 2009, at 4:58 PM, HB wrote: > > > >>>>>>> Hey, > > >>>>>>> I'm trying to create Admin application for my Django project, > > >>>>>>> here > > >>>>>>> are > > >>>>>>> some snippets: > > >>>>>>> +++ > > >>>>>>> from django.contrib import admin > > >>>>>>> admin.autodiscover() > > > >>>>>>> urlpatterns = patterns('', > > >>>>>>> (r'^admin/(.*)', admin.site.root), > > >>>>>>> ) > > > >>>>>>> INSTALLED_APPS = ( > > >>>>>>> 'django.contrib.auth', > > >>>>>>> 'django.contrib.contenttypes', > > >>>>>>> 'django.contrib.sessions', > > >>>>>>> 'django.contrib.sites', > > >>>>>>> 'django.contrib.admin', > > >>>>>>> 'djdrive.books', > > >>>>>>> ) > > >>>>>>> +++ > > > >>>>>> Can you also paste your middleware classes? > > > >>>>>> I've had this happen and can't for the life of me remember where > > >>>>>> yet, > > >>>>>> but I think it had something to do with the Session and > > >>>>>> Authentication > > >>>>>> middleware... > > > >>>>>> Eric > > > >>>>>>> But when trying to access /admin , I got this exception: > > >>>>>>> +++ > > >>>>>>> AttributeError at /admin/ > > >>>>>>> 'WSGIRequest' object has no attribute 'user' > > >>>>>>> +++ > > > >>>>>>> Any ideas? > > >>>>>>> Platform: > > >>>>>>> Django 1.0.2 > > >>>>>>> Ubuntu 8.04 > > >>>>>>> Thanks for help. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---