Open rjmoggach opened 11 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:
position_up
and position_down
methods added to the model as {position_field_name}_up
and {position_field_name}_down
PositionAdmin.position_view
using GET requests to modify dataI 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.
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 mixinPositionAdmin
3) within the adminlist_display
should includeposition_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.