1👍
So after hours of looking for various solutions, I found out how to do it the Django way.
Simply add the attribute disabled
to the field in the form (not the widget!):
# in __init__() with crispy-forms for instance
self.fields['field'].disabled = True
# as form field
field = forms.CharField(disabled=True)
And it works… Django is taking care of not saving the field, if some hacker tampered with it although it’s disabled. Only works with Django 1.9+.
👤Özer
Source:stackexchange.com