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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -