How do I filter ForeignKey choices in a Django ModelForm?

Опубликовано: 01 Март 2023
на канале: The Python Oracle
446
2

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Forest of Spells Looping

--

Chapters
00:00 Question
02:09 Accepted answer (Score 262)
02:51 Answer 2 (Score 156)
04:21 Answer 3 (Score 58)
07:21 Answer 4 (Score 26)
08:15 Thank you

--

Full question
https://stackoverflow.com/questions/2...

Question links:
[ForeignKey.limit_choices_to]: http://docs.djangoproject.com/en/dev/...

Accepted answer links:
[ModelChoiceField]: http://docs.djangoproject.com/en/dev/...

Answer 4 links:
[read my post here]: http://gravitymad.com/blog/2012/4/14/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/l...

--

Tags
#python #django #djangoforms

#avk47