python - Overriding clen method and call super in it -
i have problem overiding clean method. in modeladmin set own clean function,
form = mymodeladminform
i don't know how call in super method, @ when doesn't fill other requested fields appear yellow screen
class mymodeladminform(forms.modelform): class meta: model = mymodel fields = '__all__' def clean(self): if (mycond): raise forms.validationerror("message")
what you're trying achieve documented in official docs.
class mymodeladminform(forms.modelform): class meta: model = mymodel fields = '__all__' def clean(self): # cleaned data first cleaned_data = super(mymodeladminform, self).clean() # python 2 cleaned_data = super().clean() # python 3 if mycond: raise forms.validationerror("message")
Comments
Post a Comment