Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #form #field #disabled #django
ADD COMMENT
Topic
Name
4+4 =