1 2 3 4 5 | # Register Model with ModelAdmin
for name, model_admin in globals().copy().iteritems():
if name.endswith("Admin"):
model = globals()[name[:-5]]
admin.site.register(model, model_admin)
|
1 2 3 4 5 | # Register Model with ModelAdmin
for name, model_admin in globals().copy().iteritems():
if name.endswith("Admin"):
model = globals()[name[:-5]]
admin.site.register(model, model_admin)
|
Comments
Ummm...
Is this too hard to do? It does involve an extra 20 characters per model but gives you freedom to customise as needed later on and explicitly states whats going on.
#
@aarond10ster
Your referring to old-forms admin. Django 1.0 alpha uses newforms-admin and has completely decoupled admin from the models.
#
Thanks for that. I wrapped your code in a function. Please see snippet 1015
AK
#