问题
There used to be a neat trick for Django versions prior to 1.4 to decorate all views within the admin:
urlpatterns = patterns('',
(r'^admin/(.*)', my_decorator(lambda *args: admin.site.root(*args))),
)
This no longer works as root is deprecated. I have found some alternatives, but they seem pretty verbose compared to what I had. Is there still a hook to do this?
回答1:
Decorate every view in a url tree
http://djangosnippets.org/snippets/2607/
来源:https://stackoverflow.com/questions/14537829/decorating-all-django-admin-views-1-4