Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for drag'n'drop #35

Open
blueyed opened this issue Jul 4, 2014 · 5 comments · May be fixed by #246
Open

Support for drag'n'drop #35

blueyed opened this issue Jul 4, 2014 · 5 comments · May be fixed by #246

Comments

@blueyed
Copy link

blueyed commented Jul 4, 2014

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.

@derek-adair
Copy link

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).

  1. the user re-orders the list in place.
  2. The user drags from an unordered group of objects and creates an ordered list.

@sysradium
Copy link

@derek-adair quite old, but still wanted 👍

@devsnd
Copy link

devsnd commented Nov 3, 2017

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.

@bpartridge
Copy link

The above hack works like a charm! Added some comments on the gist for anyone looking to implement this.

@shuckc shuckc linked a pull request Apr 19, 2021 that will close this issue
@shuckc shuckc linked a pull request Apr 19, 2021 that will close this issue
@lsmith77
Copy link

anyone have it working with a current version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants