django-ordered-model
django-ordered-model copied to clipboard
Support for drag'n'drop
Is it planned to add optional support for dragging and dropping rows, e.g. in an inline admin form?
It would probably be possible to use Grappelli's inline sortables with an OrderedModel.
For what it's worth, I will be making a pass at this and a couple other alternative widgets for ordering models. (I know this is a really... really old issue).
- the user re-orders the list in place.
- The user drags from an unordered group of objects and creates an ordered list.
@derek-adair quite old, but still wanted 👍
I made a quick hack to allow drag'n'drop in the admin by extending the OrderedModelAdmin, see this gist:
https://gist.github.com/devsnd/38b9d4ff573a0611a87f10ab3042db45
Just use DragndropOrderedModelAdmin instead of OrderedModelAdmin when creating your admin class and add make_draggable as list_display item, which renders the necessary HTML/JS into the admin.
It requires the browser to support HTML5 Drag'n'Drop. It's quick and dirty, but it also just works ™
To change item order, just drag the row over another row. The dragged row will then be placed above the row it has been dragged on.
The above hack works like a charm! Added some comments on the gist for anyone looking to implement this.
anyone have it working with a current version?