Hi drakepad.

I am not aware of a good way to implement this, but this is how I have
been doing it...If you must have an arbitrary order  (not by date or
alphabetical) you must create a field specifically to store your
desired order.

class MyModel(Model):
   ... regular fields go here...
    position = IntegerField()

    class Meta:
        ordering = 'position'

this way your models will be ordered according to the value you supply
on the 'position' field. The one caveat is that since it's inside the
model, if you need to , for example swap to items position you will
have to edit both model instances and change their field accordingly. I
hope to implement some drag and drop for this in the admin...but this
is trickier than it seems...and it might be a while unitll I get the
chance.

If you do the 'position' field trick, any query set will order by it...
and at any point you can change the ordering (in your views):
new_order = MyModel.objects.all().order_by('some_field')

cheers, 
arthur


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to