jpwatts / django-positions

A Django field for custom model ordering.
BSD 3-Clause "New" or "Revised" License
284 stars 71 forks source link

added additional admin functionality #20

Open rjmoggach opened 11 years ago

rjmoggach commented 11 years ago

I've added some admin functionality that I find essential with 'ordered' models, specifically the ability to change object position in list view with up/down links. I've done this by contributing functions to the parent model within the contribute_to_class function. I also added up and down arrow icons as static files.

To use it effectively:

1) the model should probably (obviously?) be ordered by the PositionField 2) the admin class for the model should subclass or mixin PositionAdmin 3) within the admin list_display should include position_up_down_links

I can't speak for the efficiency of what I've added but at the very least it will show a good proof of concept of what makes this more useable as an app. It's probably worth having some drag and drop functionality as well and certainly some template tags and readthedocs.org/sphinx documentation to finish it off.

I would guess it will probably break when there are more than one PositionField on one model so that will need fixing.

jpwatts commented 10 years ago

Thank you for the pull request. I think what you're doing here is great. I've wanted to have admin support for a long time, but never got around to writing the code myself. I'm having a little trouble getting it to work right now, but the problem may well be on my end. From reading the code and experimenting, I do have a few thoughts:

I don't have a lot of time to dedicate to this project right now, but when I get a chance I'll take another shot at getting it to run. I'd love to have this functionality and addressing the issues above would go a long way towards getting it ready to be merged.