Code

Opened 8 years ago

Closed 8 years ago

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

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by favo@…

Fixed #2520.

comment:1 Changed 8 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 8 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@….

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.