Code

Opened 6 years ago

Closed 6 years ago

#7668 closed (invalid)

newforms.ModelChoiceField fails to clean()

Reported by: Jamey Hicks <jamey.hicks@…> Owned by: nobody
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

newforms ModelChoiceField successfully resolves a value given a primary key pk, but then in clean() attempts to look it up again using the object named by value rather than value.pk.

Attachments (1)

newform.patch (533 bytes) - added by Jamey Hicks <jamey.hicks@…> 6 years ago.
patch

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by Jamey Hicks <jamey.hicks@…>

patch

comment:1 Changed 6 years ago by mattmcc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

You're most likely doing something wrong. The value sent to the clean method is the PK value.

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.