Combining a Form and a FormSet in Django

∥☆過路亽.° 提交于 2019-12-25 06:16:41

问题


I have a FormWizard that displays three parts of a registration application. The last part involves creating a group and adding members to it. I would like to present two forms at once on the same view.

Group Builder

class GroupBuilder(forms.Form):
    name = forms.CharField(max_length=30,
                       widget=forms.TextInput(attrs={
                       'placeholder': 'eg. The Underdogs'}))

Member Builder

class MemberBuilder(forms.Form):
    first_name = forms.CharField(max_length=128)
    last_name = forms.CharField(max_length=128)
    role = forms.CharField(max_length=128)

How can I present the GroupBuilder Form and a StudentBuilder formset at once?

来源:https://stackoverflow.com/questions/24090043/combining-a-form-and-a-formset-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!