#5188 and backwards-incompatible change (remove order_by from date-based generic views)

0 views
Skip to first unread message

James Bennett

unread,
Aug 17, 2007, 1:10:38 AM8/17/07
to django-d...@googlegroups.com
After being somewhat startled by the results of the archive_year
generic view and finding that the source of my confusion was an
explicit "order_by()" being done in that view, and finding another in
archive_index, I opened #5188 with a patch which removes these calls
to "order_by()".

I think the reasoning I've provided in the ticket is a good argument
for why we should make this change, but it would be
backwards-incompatible, since anyone who was relying on that behavior
will now need to apply ordering prior to handing a QuerySet over to
one of those views.

So... anyone have strong feelings against the change?


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

James Bennett

unread,
Aug 17, 2007, 1:16:08 AM8/17/07
to django-d...@googlegroups.com
And I just realized I missed #3134, which argued for a slightly
different solution, in the form of an 'order_by' parameter to the
views.

Personally, I think it's easier to just skip the parameter and rely on
the fact that you can apply whatever ordering you like to the QuerySet
before passing it to the view, but it's worth noting as an alternate
proposal.

Gary Wilson

unread,
Aug 17, 2007, 1:00:08 PM8/17/07
to Django developers
On Aug 17, 12:16 am, "James Bennett" <ubernost...@gmail.com> wrote:
> And I just realized I missed #3134, which argued for a slightly
> different solution, in the form of an 'order_by' parameter to the
> views.
>
> Personally, I think it's easier to just skip the parameter and rely on
> the fact that you can apply whatever ordering you like to the QuerySet
> before passing it to the view, but it's worth noting as an alternate
> proposal.

Yes, I do not like the idea of adding a new order_by parameter
either. However, there is a bit of an issue involving the
archive_index view though because it also uses a num_latest parameter,
IMHO implying that the items will be sorted by date_field descending.

Gary

James Bennett

unread,
Aug 19, 2007, 3:47:52 PM8/19/07
to Django developers
On Aug 17, 12:00 pm, Gary Wilson <gary.wil...@gmail.com> wrote:
> Yes, I do not like the idea of adding a new order_by parameter
> either. However, there is a bit of an issue involving the
> archive_index view though because it also uses a num_latest parameter,
> IMHO implying that the items will be sorted by date_field descending.

Hm.

Since archive_index is explicitly meant to provide the latest objects,
I could see keeping the order_by in that view, and making it clear in
the docs that it'll override any ordering you try to do on the
QuerySet before having to the view. But archive_year should drop its
explicit ordering for consistency with the other generic views.

Reply all
Reply to author
Forward
0 new messages