3 ms·
Is this what you are talking about? Taken from:http://uswaretech.com/blog/2010/01/doing-things-with-django-forms/ http://uswaretech.com/blog/2010/01/doing-thing
by weaksauce 17y ago
Is this what you are talking about? Taken from:http://uswaretech.com/blog/2010/01/doing-things-with-django-forms/ http://uswaretech.com/blog/2010/01/doing-things-with-django-... higher in this thread.
5.
Prob. You want to create a field which has cross field validations.
Ans. Create a field with a .clean
class UserForm(forms.Form):
username = forms.CharField()
password1 = forms.PasswordField()
password2 = forms.PasswordField()
def clean(self):
data = self.cleaned_data
if "password1" in data and "password2" in data and data["password1"] != data["password2"]:
raise forms.ValudationError("Passwords must be same")