> I want to give my users the ability to drag the objects around (or use
> some other method) to define a new sort order.
>
> This sort order has nothing to do with the data. I want to save this
> order in the database, so it can display them in that order.

Ah! Now I see. Let me try again to be helpful. :-)

A couple of questions:

1. How many objects are we talking about? 10? 100? 10^6?
2. Can a single object participate in multiple orderings?

If the amount of data is small, you could simply save the ordering in
a CharField/TextField as a list of comma separated IDs.  We have a
trivial model called ConfigValues that is simply name/value pairs that
stores various config values (I know, duh!). Anyway, we have a few of
these that  basically do what you described - remember the display
order for various groups of objects. We only have groups of up to 50
or 60 objects (which can be in more than one group), so it suffices,
but it wouldn't work well for large collections.

We had the additional problem that a group did not have to be type-
homogeneous, so we actually save an "object reference" (which is
<model_name>.<id>, e.g. content_article.154). When we unpack one
there's a moderate amount of DB work, but we have a template-component
cache mechanism so it doesn't cause that much of a hit.

Peter

--~--~---------~--~----~------------~-------~--~----~
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