ordering = (('pub_date', 'ASC'), ('name', 'DESC'), ('other',
'RANDOM'))
What do you think of this syntax?
ordering = ('pub_date+', 'name-', 'other?')
This syntax would be used when declaring default ordering in models
(via the "ordering" argument), and it'd be used in the "order_by"
parameter to the database API.
I like it because it's a lot less crufty, easier to type and easier to
read.
The change can even be backwards-compatible if we wanted it to be,
although I'd want to phase out the old-style ordering eventually.
Thoughts?
Adrian
Adrian Holovaty wrote:
> Instead of the following:
>
> ordering = (('pub_date', 'ASC'), ('name', 'DESC'), ('other',
> 'RANDOM'))
>
> What do you think of this syntax?
>
> ordering = ('pub_date+', 'name-', 'other?')
> The change can even be backwards-compatible if we wanted it to be,
> although I'd want to phase out the old-style ordering eventually.
>
> Thoughts?
similar to SQLObject, where IIRC you can declare a DESC order using
order_by='-pub_date'. you could imply a ASC order (that is without the
the + at the end).
go for it, adrian.
-- deelan.
Nice. Seems like it would make sense to follow the lead of SQLObject
here, prepending a "-" for descending order. It has the advantage of
making sense mathematically as well.
pb