#21860 closed Cleanup/optimization (fixed)

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

Reported by: Keryn Knight <django@…> Owned by: anubhav9042
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

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 Changed 19 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 17 months ago by anubhav9042

  • Cc anubhav9042@… added
  • Owner changed from nobody to anubhav9042
  • Status changed from new to assigned

comment:3 Changed 17 months ago by timo

  • Has patch set

comment:4 Changed 17 months ago by timo

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 17 months 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 17 months ago by Tim Graham <timograham@…>

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

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