10 examples of 'form.cleaned_data' in Python

Every line of 'form.cleaned_data' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
421def clean(self):
422 """
423 Hook for doing any extra form-wide cleaning after Field.clean() has been
424 called on every field. Any ValidationError raised by this method will
425 not be associated with a particular field; it will have a special-case
426 association with the field named '__all__'.
427 """
428 return self.cleaned_data
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

165@property
166def cleaned_data(self):
167 '''Form cleaned data, the data after the validation
168 algorithm has been run. If the form was
169 not yet validated, this property will kick off the process and return
170 cleaned.'''
171 self._check_unwind()
172 return self._cleaned_data
71def clean(self):
72 if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
73 if self.cleaned_data['password1'] != self.cleaned_data['password2']:
74 raise forms.ValidationError(_("The two password fields did not match."))
75 return self.cleaned_data
35def clean(self):
36 repo_type = self.cleaned_data.get('repo_type', None)
37 repo = self.cleaned_data['repo']
38 if repo_type is None: # required field
39 return self.cleaned_data
40
41 getattr(self, 'validate_%s_url' % repo_type)(repo)
42 return self.cleaned_data
13def clean(self):
14 for key, value in self.cleaned_data.items():
15 if value in ("", None):
16 del self.cleaned_data[key]
17 return self.cleaned_data
35def clean(self):
36 if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
37 if self.cleaned_data['password1'] != self.cleaned_data['password2']:
38 raise forms.ValidationError(_(u'You must type the same password each time'))
39 return self.cleaned_data
44def clean(self):
45 cleaned_data = self.cleaned_data
46
47 self.colors_data = {}
48 if 'colors_hidden' in cleaned_data and cleaned_data['colors_hidden'].strip():
49 self.colors_data = json.loads(cleaned_data['colors_hidden'])
50 if not self._validate_colors(self.colors_data):
51 self._errors['colors_hidden'] = self.error_class([_(u"Invalid data")])
52 del cleaned_data['colors_hidden']
53
54 return cleaned_data
86def clean(self):
87 # 判断验证码
88 code = self.request.session.get('register_code', '')
89 verification_code = self.cleaned_data.get('verification_code', '')
90 if not (code != '' and code == verification_code):
91 raise forms.ValidationError('验证码不正确')
92 return self.cleaned_data
14def clean(self):
15 print self.cleaned_data
16 print self.fields
17 print self.error_class
97def clean(self):
98 cleaned_data = self.cleaned_data
99 if "email" in cleaned_data:
100 try:
101 self.user = User.objects.get(email=cleaned_data['email'])
102 except User.DoesNotExist:
103 self._errors['email'] = self.error_class(
104 [_(u'The email does not correspond to any registered user.')]
105 )
106 del cleaned_data['email']
107 return cleaned_data
108
109 return cleaned_data

Related snippets