On Jan 21, 4:25 pm, "Matthew Flanagan" <[EMAIL PROTECTED]> wrote:
> ADMIN_FIND_ADMIN_CLASSES = True
> ADMIN_MODELS = (
>     'myproj.myapp.admin.PollAdmin',
>     'someotherproj.someapp.admin.FooAdmin',
> )

My 2 (belated) cents on the issue: the settings.py idea is the best
I've seen in the thread so far.  Let me throw in another option: maybe
it's time to return to Meta?  In the dawn before time
(pre-magic-removal) Meta housed all of the Admin options until it was
determined which merely served the Admin itself and which were more
generally useful, breaking things into two inner-classes, Meta and
Admin.  If we want to deprecate the inner-Admin class it makes sense to
me that we can use the Meta class we still have lying around for odd
jobs (like ordering and verbose_name_plural).  For instance::

class Meta:
    show_in_admin = True
    admin_model = ModelAdmin({
        'list_display': ... })

Certainly that should look eerily familiar to pre-0.95 developers.  You
could easily then do something like::

admin_model = ModelAdmin(ModelName.Admin.__dict__)

This becomes the easy to add explicit "magic" sub-typing of the inner
Admin class, and you just have the Admin assume until deprecated (ie,
one version later when oldforms is deprecated) that the above line
already exists in Meta if it doesn't exist.  For simple classes
up-conversion is simply add two lines to Meta (show_in_admin and
admin_model).

This keeps Admin information inside the model (which I'm still
uncertain if that is a Bad Thing just yet) and yet still adds a good
amount of explicitness.  Those worried about "admin contamination" of
apps for non-admin users could handle that difficulty using something
akin to::

if use_admin_flag:
   from django.contrib.admin import ModelAdmin
else:
   def ModelAdmin(dict):
       pass


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

Reply via email to