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

Feature request: Rearrange order of objects in modeladmin index view #9

Open
adriaant opened this issue Aug 24, 2016 · 11 comments
Open
Labels
type:Enhancement New feature or request

Comments

@adriaant
Copy link

In wagtail admin, it is possible to rearrange the order of pages in the admin editor. This is a feature that would work equally well for custom models managed via modeladmin, provided the models inherit the Orderable mixin. This is useful for pages that provide a list of all/filtered objects of a given model, but for which you want to provide the user with an option to define the order of the objects on the page.

For example:
A custom model for FAQ categories and a page that grabs the categories dynamically during rendering and displays them according to the order stored in the db. In other words, all the user has to do is create categories (and the contained questions) in the modeladmin interface.

Is this something already being considered or worth discussing?

@gasman gasman added the type:Enhancement New feature or request label Aug 24, 2016
@ababic
Copy link

ababic commented Oct 8, 2016

One approach to this would be to create an OrderableMixin class, to be used with the ModelAdmin class where needed (much like the ThumbnailMixin). The basic elements of which would be:

  1. Getting the ID/order values for each object into the listing, so the data is available to create reorder requests
  2. Some view functionality to take care of reorder requests
  3. Some javascript with drag-and-drop support to bind it all together

From a UI/UX perspective, it'd make sense to match the page reordering approach as closely as possible. I haven't looked yet, but I'd expect there'd be some JS/styles that can be reused, or at least serve as a decent starting point to copy from.

I'd be happy to work on a pull-request.

@adriaant
Copy link
Author

adriaant commented Feb 6, 2017

What is the status of this ticket? I noticed PR is closed, but has actually not been merged.

@ababic
Copy link

ababic commented Feb 6, 2017

Hey @adriaant. The branch still exists here if you wanted to copy/paste for a project in the meantime: https://github.com/rkhleics/wagtail/tree/modeladmin/orderableadmin-2

I closed wagtail/wagtail#3103 because It didn't look like it was going to be reviewed any time soon, and there are a bunch of other issues that need addressing that would just introduce a bunch of merge conflicts for that wagtail/wagtail#3103. I'd rather just recreate the functionality later (with a bit less scope-creep) after having rebased everything on master.

@adriaant
Copy link
Author

adriaant commented Feb 7, 2017

@ababic Understood, thanks for the quick and clear reply!

@vstoykov
Copy link

This will be very nice addition to Wagtail.

@inostia
Copy link

inostia commented Dec 14, 2018

Is there any reason why this wasn't merged yet? This is a necessary feature for my org, we need to render the items on the FE in the order they appear on the admin interface.

@tomdyson
Copy link

@inostia why what wasn't merged? This is an issue, not a PR. There was an associated PR, but that was closed for reasons outlined above.

@inostia
Copy link

inostia commented Dec 15, 2018

Good call @tomdyson, yes this is a GH issue. I was referring to the PR referenced in this thread, and the reason given for not merging that the original PR wasn't reviewed (as well as the apparent conflicts from the work), which led me to believe that this feature is not a high priority for the Wagtail team. I'd be happy to take a look at this (and @ababic's work) this weekend to see if I can contribute. If it's a super hairy issue I may end re-working requirements a bit, and attaching the Orderable to a page instead.

@elton2048
Copy link

For guys who requires this feature I created a package wagtail-orderable for that. Simply extends with the Orderable model and apply OrderableMixin for wagtail_hooks.py should give you the feature. Leave any issue if any.

Most code are contributed by @ababic from this commit with minor modification for mainly versioning issue. Once again thanks for his contribution.

@ababic
Copy link

ababic commented Dec 29, 2018

@elton2048 thank you for taking the time to put wagtail-orderable together. I really feel a separate package is the best way to go here. Far easier to gather feedback and evolve things that way.

@inostia
Copy link

inostia commented Jan 7, 2019

Thank you @elton2048! This is awesome, will give it a try soon.

@laymonage laymonage transferred this issue from wagtail/wagtail Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants