Tuesday, August 30, 2011

Argh: templates, admin, and app loading order

So... I'm trying to keep all site-specific code and overrides to third-
party app behavior in a single "current_site" app in my project.

For the sake of template loading order, this app is listed first in
INSTALLED_APPS so that its templates are located before the third-
party defaults.

But...

Now I can't use this app to override the default ModelAdmin
declarations for third-party apps because of course
"admin.site.unregister(ThirdPartyModel)" throws a NotRegistered
exception because current_site appears before the third party app in
INSTALLED_APPS.

Ah, the irony.

Now, I know how to work around this: create a separate app for admin
overrides that loads at the end of the INSTALLED_APPS list instead of
the beginning.

But am I the only one who thinks that feels a little clumsy?

Thoughts? Other solutions?

Thanks,
-Nan

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment