Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2520 closed defect (fixed)

[patch] Invalid SQL generated when searching, using Foreign Keys in ordering but not in searching

Reported by: coordt@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A ProgrammingError, missing FROM-clause entry is generated in the following specific conditions:

  1. A Foreign Key is used in model.Meta.ordering
  2. The Foreign Key is NOT in the model.Admin.search_fields
  3. You perform a search.

The JOIN is not made with the Foreign Key, but it is listed in the ORDER BY clause.

Attachments (1)

django_admin_change_list_order_bug.diff (681 bytes ) - added by favo@… 18 years ago.
Fixed #2520.

Download all attachments as: .zip

Change History (3)

by favo@…, 18 years ago

Fixed #2520.

comment:1 by favo@…, 18 years ago

Summary: Invalid SQL generated when searching, using Foreign Keys in ordering but not in searching[patch] Invalid SQL generated when searching, using Foreign Keys in ordering but not in searching

comment:2 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [3794]) Fixed #2520 -- Fixed a problem with invalid SQL being generated by admin
interface in certain circumstances. Patch from favo@….

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