2010/6/8 grimmus <[email protected]>

> Hi,
>
> I have a staff app that lists staff photos and their names. The client
> would like to be able to re-order these in the admin area easily.
> Ideally there would be a dropdown where the user could select between
> 1 and n which object should appear in what position in the list.
>
> I could add an extra integer field to the model, but how would i
> initially populate it with a value ? And how would the dropdown work
> in the admin area ?
>
> Thank you for any tips/advice.
>

Hi,

I'm not sure if this is the same problem, but what I did is to use a Mixin
like this:

djangosnippets.org/snippets/259/

then, in a custom change_list.html template I used JQuery sortable to drag
and drop items, when an item is dropped to the new position, an ajax call in
the background calls a custom view that saves the new order (the method is
just one: insert_at called with the new position as argument).


-- 
Alessandro Pasotti
w3:   www.itopen.it

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to