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

added additional admin functionality #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

added additional admin functionality #20

wants to merge 1 commit into from

Conversation

rjmoggach
Copy link

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
Copy link
Owner

jpwatts commented Nov 6, 2013

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:

  • A ready-to-go example app would be nice
  • I'd rather see the position_up and position_down methods added to the model as {position_field_name}_up and {position_field_name}_down
  • The existing tests don't pass on Django 1.5
  • The existing tests won't run on Django 1.6 (this is a little unfair to you, I know, since 1.6 was released after you submitted your PR)
  • There aren't tests for the new functionality
  • The new functionality isn't documented
  • I'm uncomfortable with PositionAdmin.position_view using GET requests to modify data

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.

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 this pull request may close these issues.

2 participants