Added after_sorting method to SortableAdminBase class that can be defined on a model admin to be executed after sorting has occurred.

This commit is contained in:
Brandon Taylor
2018-07-09 07:49:55 -04:00
parent 3f49a72a6d
commit 6d5f9e97b4
2 changed files with 15 additions and 1 deletions
+8 -1
View File
@@ -61,6 +61,9 @@ class NoteInline(SortableStackedInline):
model = Note
extra = 2
def after_sorting(self):
print('I happened after sorting')
class GenericNoteInline(SortableGenericStackedInline):
model = GenericNote
@@ -83,9 +86,13 @@ class ProjectAdmin(SortableAdmin):
NonSortableCreditInline, NonSortableNoteInline
]
list_display = ['__str__', 'category']
list_filter = ('category__title',)
after_sorting_js_callback_name = 'afterSortCallback'
sortable_change_list_template = 'adminsortable/custom_change_list.html'
sortable_change_form_template = "adminsortable/custom_change_form.html"
sortable_change_form_template = 'adminsortable/custom_change_form.html'
def after_sorting(self):
print('I happened after sorting')
admin.site.register(Project, ProjectAdmin)