Added an override for the admin add_view to prevent the change form template extends variable from not being populated.
This commit is contained in:
@@ -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.
|
django-admin-sortable is currently used in production.
|
||||||
|
|
||||||
|
|
||||||
### What's new in 1.5?
|
### What's new in 1.5.1?
|
||||||
- More Brazilian Portugese translations (Thanks to @gladson)
|
- Fixed a bug that could cause the change_form template to not be populated correctly when adding a new record.
|
||||||
|
|
||||||
|
|
||||||
### Future
|
### Future
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
VERSION = (1, 5, 0) # following PEP 386
|
VERSION = (1, 5, 1) # following PEP 386
|
||||||
DEV_N = None
|
DEV_N = None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,16 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
|||||||
}
|
}
|
||||||
return render(request, self.sortable_change_list_template, context)
|
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):
|
def change_view(self, request, object_id, extra_context=None):
|
||||||
self.has_sortable_tabular_inlines = False
|
self.has_sortable_tabular_inlines = False
|
||||||
self.has_sortable_stacked_inlines = False
|
self.has_sortable_stacked_inlines = False
|
||||||
|
|||||||
Reference in New Issue
Block a user