On Jul 19, 2008, at 10:36 AM, Eric Abrahamsen wrote:

> Short answer: register all your models with admin.site.register(), and
> use admin.autodiscover() too.

This is correct. admin.autodiscover() simply imports admin.py modules  
in your INSTALLED_APPS. Previously, in the days of the branch, there  
was a time when there was no convention and people all relied on  
importing the admin module in their __init__.py which worked well for  
many, but others had really bad failures.

One thing to keep in mind that really isn't described as well as it  
could in the docs is that admin.autodiscover() is really there for  
convenience. Most of the time you will only ever need to register your  
models with the default AdminSite instance which is located at  
django.contrib.admin.site. However, if you need to have more than one  
admin site or would like to modify which models are displayed on a  
single admin then you will likely be creating your own AdminSite class  
and registering models to that instead of the default. In which case  
the admin.autodiscover() is not needed and app admin.py module merely  
become a place for storing ModelAdmin classes and if its a reusable  
app you would also keep around register calls for the default  
AdminSite instance for the user common case.

Brian Rosner
http://oebfare.com


--~--~---------~--~----~------------~-------~--~----~
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