On 23 nov, 01:27, Christophe Pettus <x...@thebuild.com> wrote:
> Apologies if this is a FAQ...

Not AFAIK

> I'd like to take a QuerySet and order it in memory, rather than using 
> 'order_by'.  However, I need it to stay a QuerySet, since I'll be feeding it 
> to the .queryset attribute of a ModelChoiceField.  Is there any way of 
> accomplishing this?


Strictly speaking, you don't need the queryset attribute of a
ModelChoiceField to be a QuerySet instance - as long as the object you
pass in has a '.all()' method that returns an iterable, you should be
fine (cf django/forms/models.py for the definition of the
ModelChoiceField class and the companion ModelChoiceIterator class).

Also, note that if you manually set the .choices property of your
ModelChoiceField, it will totally bypass access to the .queryset
attribute.

HTH

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

Reply via email to