#15694: Overriding Django admin views and nested transactions ----------------------------------+--------------------------- Reporter: etianen | Owner: nobody Status: new | Milestone: Component: django.contrib.admin | Version: 1.2 Keywords: | Triage Stage: Unreviewed Has patch: 0 | ----------------------------------+--------------------------- This problem is related to #2227, but has a potentially easier solution.
Because the Django admin site directly decorates it's methods with @commit_on_success, and @commit_on_success is unaware on nested outer transactions, it's currently impossible to override an admin view and maintain data integrity. This is a problem for django-reversion, which augments many of the django admin methods by wrapping them in a revision. Ideally, I would be able to save the primary model and it's associated revision data in a single transaction. Currently, however, the superclass view commits the transaction and thus forces the associated revision data to be saved in it's own transaction. Obviously, a satisfactory fix for #2227 would solve this. However, this ticket seems to be a bit dead, due to conflicting ways of solving it. Fixing the problem of overriding admin views is easier, however. My proposed solution is to move the existing @commit_on_success and @csrf_protect decorators off the methods, and apply them in the admin site under AdminSite.admin_view instead. This would mean they are applied after all subclassing has taken place. I've implemented a tentative patch here: https://github.com/etianen/django/commit/6682fc31c810f763f08dcf14505c5762ab1d18a1 -- Ticket URL: <http://code.djangoproject.com/ticket/15694> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.