discussion for #3134 - The archive_year date-based generic view should not override a model's default ordering

1 view
Skip to first unread message

Gary Wilson

unread,
Jan 15, 2007, 12:36:14 AM1/15/07
to Django developers
http://code.djangoproject.com/ticket/3134

Bringing discussion to the list...

I would also say that all the date based generic views should have the
same behavior, but I'm not sure if that should be making all the date
based views take an order_by parameter, or to just make archive_year
act like the others and used the model's default ordering.

I think the order_by parameter would be more flexible, since when you
have a model with multiple date fields, you might be using one for
default ordering but want to do a archive_year ordered by one of the
others. Or maybe you would like to use descending ordering instead of
ascending.

But unlike the current attached patch, I think it would be better if
the ordering defaults to the model's default ordering if no order_by
parameter is passed instead of ordering by the date field used for the
archive lookup. This makes the ordering explicit (and non magic).

So in the end, I vote for adding an order_by parameter to the archive
generic views, and I guess for the object_list view too.

paolo

unread,
Jan 16, 2007, 6:21:51 AM1/16/07
to Django developers
Your solution looks good to me, as it adds more power to generic views
keeping their behavior consistent, without exceptions (and this point
was exactly what I tried to express in #3134).

Reply all
Reply to author
Forward
0 new messages