Answers for "set form field disabled django"

-1

set form field disabled django

class PatientForm(forms.ModelForm):

    def __init__(self, *args, **kwargs):
       super(PatientForm, self).__init__(*args, **kwargs)
       self.fields['field'].widget.attrs['readonly'] = True

    class Meta:
        model = Patient
Posted by: Guest on August-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language