Opened 10 years ago

Closed 10 years ago

#21860 closed Cleanup/optimization (fixed)

ModelChoiceField documentation doesn't include the `to_field_name` optional argument

Reported by: Keryn Knight <django@…> Owned by: ANUBHAV JOSHI
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: anubhav9042@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The current ModelChoiceField arguments documentation doesn't cover the to_field_name attribute for overriding which value is used by prepare_value and to_python methods in lieu of the pk.

Given the argument is technically part of the available public API, it should probably be documented.

Change History (6)

comment:1 by Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted

comment:2 by ANUBHAV JOSHI, 10 years ago

Cc: anubhav9042@… added
Owner: changed from nobody to ANUBHAV JOSHI
Status: newassigned

comment:3 by Tim Graham, 10 years ago

Has patch: set

comment:4 by Tim Graham, 10 years ago

Keryn, the PR linked above looks ok to me, but I was wondering if there was a specific use case that you came across for this that we might be able to use to improve the patch?

comment:5 by Keryn Knight <django@…>, 10 years ago

The specific use-case wasn't mine, it was someone in IRC's. The rationale for needing to do that wasn't (and isn't) clear to me, but evidently at least two people wanted it (whoever wrote the implementation, and the IRC user trying to do the same). I've previously commented on the PR, and assuming Anubhav can make the changes you've since noted on it, am happy with it.

comment:6 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In ad43fdaa0008ce8d3d05e840f67af631d1329489:

Fixed #21860 -- Added to_field_name to ModelChoiceField docs.

Thanks Keryn Knight for the suggestion.

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