#3825 closed (duplicate)
crash on sorting on foreign key with default ordering desc
Reported by: | 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)
Change History (7)
by , 18 years ago
Attachment: | query_ordering.patch added |
---|
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 18 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
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 , 17 years ago
Cc: | added |
---|---|
Component: | Database wrapper → django-admin.py runserver |
Keywords: | None added; ordering foreignkey removed |
Summary: | crash on sorting on foreign key with default ordering desc → None |
Version: | SVN → 0.91 |
comment:4 by , 17 years ago
Component: | django-admin.py runserver → Database wrapper |
---|---|
Keywords: | ordering foreignkey added; None removed |
Summary: | None → crash on sorting on foreign key with default ordering desc |
Version: | 0.91 → SVN |
Undo anonymous breakage of tickets
patch