Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#12582 closed (fixed)

Model validation of ForeignKeys ignore limit_choices_to

Reported by: Honza_Kral Owned by: Honza_Kral
Component: Uncategorized Version: master
Severity: Keywords: validation limit choices foreign keys
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When checking valida value of a FK field:

self.rel.to._default_manager.get(**{self.rel.field_name:value})

is used instead of more efficient .exists() and limit_choices_to option is ignored

Attachments (1)

12582.diff (2.4 KB) - added by Honza_Kral 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by Honza_Kral

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by Honza_Kral

comment:2 Changed 5 years ago by Honza_Kral

  • Needs tests unset

comment:3 Changed 4 years ago by jkocherhans

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

(In [12271]) Fixed #12582. Model validation on ForeignKeys now respects limit_choices_to. Thanks, Honza Král.

comment:4 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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.