Closed objectif-securite closed 9 months ago
Hello, In a form where I want to display fields as readonly, I overrided the init method of the ModelForm and set something like this:
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["serial"].disabled = True self.fields["serial"].required = False
It works as expected in a Form, but not in a FormCollection. In the latter, the value is taken into account and submitted to the DB.
Hello, In a form where I want to display fields as readonly, I overrided the init method of the ModelForm and set something like this:
It works as expected in a Form, but not in a FormCollection. In the latter, the value is taken into account and submitted to the DB.