Remove fields from ModelForm

前端 未结 5 977
忘掉有多难
忘掉有多难 2020-12-09 06:16

i have a simple ModelForm:

class MyForm(ModelForm):

    def __init__(self, *args, **kwargs):
        super(MyForm, self).__init__(*args, **kwargs)
        d         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 06:43

    You can use the exclude property to remove fields from a ModelForm

    exclude = ('field_name1', 'field_name2,)
    

提交回复
热议问题