Opened 7 years ago

Closed 7 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: master
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


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 Changed 7 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by ANUBHAV JOSHI

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

comment:3 Changed 7 years ago by Tim Graham

Has patch: set

comment:4 Changed 7 years ago by Tim Graham

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 Changed 7 years ago by Keryn Knight <django@…>

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 Changed 7 years ago by Tim Graham <timograham@…>

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