Opened 17 years ago

Closed 17 years ago

Last modified 15 years ago

#3825 closed (duplicate)

crash on sorting on foreign key with default ordering desc

Reported by: David S. <davidschein@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: ordering foreignkey
Cc: None Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This bug became evident in the admin interface when selecting a column header to sort on a column that is a foreign key in the model. When the model to which it refers has a Meta.ordering that is descending on a field, then the ordering logic failed because it failed to remove the leading minus sign in the SQL.

Patch included.

Attachments (1)

query_ordering.patch (693 bytes ) - added by David S. <davidschein@…> 17 years ago.
patch

Download all attachments as: .zip

Change History (7)

by David S. <davidschein@…>, 17 years ago

Attachment: query_ordering.patch added

patch

comment:1 by Simon G. <dev@…>, 17 years ago

Triage Stage: UnreviewedReady for checkin

comment:2 by Malcolm Tredinnick, 17 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

People need to stop using rsplit() in patches. It doesn't work with Python 2.3. Triagers, please watch out for this.

I don't understand why the rsplit() is even needed here. I understand the checking for a hyphen on the column name, but not why you are expecting multiple dots in the table name. I don't believe a sequence like table1.table2.column_name is going to work in any case -- the SQL for the table joins will be wrong, won't it?

comment:3 by anonymous, 17 years ago

Cc: None added
Component: Database wrapperdjango-admin.py runserver
Keywords: None added; ordering foreignkey removed
Summary: crash on sorting on foreign key with default ordering descNone
Version: SVN0.91

comment:4 by Ramiro Morales, 17 years ago

Component: django-admin.py runserverDatabase wrapper
Keywords: ordering foreignkey added; None removed
Summary: Nonecrash on sorting on foreign key with default ordering desc
Version: 0.91SVN

Undo anonymous breakage of tickets

comment:5 by Gary Wilson, 17 years ago

Resolution: duplicate
Status: newclosed

duplicate of #2895.

Note: See TracTickets for help on using tickets.
Back to Top