Added an override for the admin add_view to prevent the change form template extends variable from not being populated.

master
Brandon Taylor 2013-06-20 15:47:41 -04:00
parent 8a0a52eca7
commit b3fd59da02
3 changed files with 13 additions and 3 deletions

View File

@ -218,8 +218,8 @@ ordering on top of that just seemed a little much in my opinion.
django-admin-sortable is currently used in production.
### What's new in 1.5?
- More Brazilian Portugese translations (Thanks to @gladson)
### What's new in 1.5.1?
- Fixed a bug that could cause the change_form template to not be populated correctly when adding a new record.
### Future

View File

@ -1,4 +1,4 @@
VERSION = (1, 5, 0) # following PEP 386
VERSION = (1, 5, 1) # following PEP 386
DEV_N = None

View File

@ -168,6 +168,16 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
}
return render(request, self.sortable_change_list_template, context)
def add_view(self, request, form_url='', extra_context=None):
if extra_context is None:
extra_context = {}
extra_context.update({
'change_form_template_extends': self.change_form_template_extends
})
return super(SortableAdmin, self).add_view(request, form_url,
extra_context=extra_context)
def change_view(self, request, object_id, extra_context=None):
self.has_sortable_tabular_inlines = False
self.has_sortable_stacked_inlines = False