Django and fieldsets on ModelForm

前端 未结 5 1441
失恋的感觉
失恋的感觉 2020-12-04 10:34

I know you can specify fieldsets in django for Admin helpers. However, I cannot find anything useful for ModelForms. Just some patches which I cannot use. Am I missing somet

5条回答
  •  生来不讨喜
    2020-12-04 10:41

    Fieldsets in modelforms are still in "design" stage. There's a ticket in Django trac with low activity.

    It's something I've been interested in researching myself in the near future, but since I haven't done it yet the best I can offer are these snippets:

    • Form splitting/Fieldset templatetag
    • Sectioned Form
    • Forms splitted in fieldsets

    Edit: I just noticed this question again and I realize it needs an edit to point out Carl's project django-form-utils which contains a BetterForm class which can contain fieldsets. If you like this project give him a +1 for his answer below :)

提交回复
热议问题