On Wed, 2008-11-26 at 14:22 +0100, Thomas Guettler wrote:
> Jarek Zgoda schrieb:
> > Wiadomość napisana w dniu 2008-11-26, o godz. 10:20, przez Thomas  
> > Guettler:
> >
> >   
> >> I am missing order by nulls [first|last]
> >>
> >> Either I am blind, or it is not possible.
> >>     
> >
> >
> > I think this is database-dependent.
> >   
> I know, but I would like to force this with django ORM.
> 
> something like this:
> MyModel.objects.all().order_by('due_date', nulls_last=True)
> 
> I don't know if all database backends support this. Postgres does.

I'm not really in a great hurry to implement anything like this. Django
supplies a reasonable layer over SQL, but doesn't intend to cover every
single case and this is on the edge. One could also argue that if you're
routinely sorting by columns that contain NULLs and you rely on the
NULLs being first or last, you're probably not following "best
practices" at some level (and, yes, I fully realise there are
counter-arguments as well). But I think we can manage to go on living
without this type of option.

By design, QuerySets and Query are subclassable. If you really need this
support, add an extra call to your QuerySet subclass that incorporates
that into the extension of Query.as_sql() and use that QuerySet subclass
as the one returned by your custom manager.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to