diff --git a/README.md b/README.md index 38eace8..de643f3 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/adminsortable/__init__.py b/adminsortable/__init__.py index 661aa59..e1c4760 100755 --- a/adminsortable/__init__.py +++ b/adminsortable/__init__.py @@ -1,4 +1,4 @@ -VERSION = (1, 5, 0) # following PEP 386 +VERSION = (1, 5, 1) # following PEP 386 DEV_N = None diff --git a/adminsortable/admin.py b/adminsortable/admin.py index 3efd4d4..555f6c3 100644 --- a/adminsortable/admin.py +++ b/adminsortable/admin.py @@ -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