Refactored sorting JS files to be includes so that server-side variables may be passed to them.

Added 'after_sorting_js_callback_name' attribute to SortableAdminBase.
Added callback to be executed after sorting for each of the possible sorting scenarios.
Added custom template examples to add a callback to be executed when sorting is finished.
This commit is contained in:
Brandon Taylor
2018-06-18 11:40:24 -04:00
parent fa8a5f12a8
commit e35f36b25a
10 changed files with 270 additions and 193 deletions
+3
View File
@@ -83,6 +83,9 @@ class ProjectAdmin(SortableAdmin):
NonSortableCreditInline, NonSortableNoteInline
]
list_display = ['__str__', 'category']
after_sorting_js_callback_name = 'afterSortCallback'
sortable_change_list_template = 'adminsortable/custom_change_list.html'
sortable_change_form_template = "adminsortable/custom_change_form.html"
admin.site.register(Project, ProjectAdmin)