Added an override for the admin add_view to prevent the change form template extends variable from not being populated.
parent
8a0a52eca7
commit
b3fd59da02
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
VERSION = (1, 5, 0) # following PEP 386
|
||||
VERSION = (1, 5, 1) # following PEP 386
|
||||
DEV_N = None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue