Login

Snippets by johj

Snippet List

Drag and drop ordering of admin list elements using jQuery UI

Adds drag-and-drop ordering of rows in the admin list view. The only requirements is that the model has a field holding the position and that the field is made list_editable in the ModelAdmin. The changes of the ordering are applied after clicking 'Save'. The included javascript uses [jQuery UI's sortable](http://jqueryui.com/demos/sortable/) plugin Inspired by snippets [#1053](http://djangosnippets.org/snippets/1053) and [#998](http://djangosnippets.org/snippets/998/). Another similar snippet using AJAX is [#2047](http://djangosnippets.org/snippets/2047/).

  • admin
  • sort
  • jquery
  • order
  • sortable
Read More

johj has posted 1 snippet.