Opened 9 years ago

Closed 9 years ago

Last modified 9 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
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: UI/UX:

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@… 9 years ago.
Fixed #2520.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by favo@…

Fixed #2520.

comment:1 Changed 9 years ago by favo@…

  • Summary changed from Invalid SQL generated when searching, using Foreign Keys in ordering but not in searching to [patch] Invalid SQL generated when searching, using Foreign Keys in ordering but not in searching

comment:2 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(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