I have a form like this:
class My_Form(ModelForm):
class Meta:
model = My_Class
fields = ('first_name', 'last_name' , 'address')
How can I put the address field as optional?
class My_Form(forms.ModelForm):
class Meta:
model = My_Class
fields = ('first_name', 'last_name' , 'address')
def __init__(self, *args, **kwargs):
super(My_Form, self).__init__(*args, **kwargs)
self.fields['address'].required = False