clean method for validation
Posted
by apoorva
on Stack Overflow
See other posts from Stack Overflow
or by apoorva
Published on 2010-06-15T06:37:05Z
Indexed on
2010/06/15
6:42 UTC
Read the original article
Hit count: 240
django-forms
hi.. i have the following form class with corresponding clean methods...
class SOFIATMUserLogin(forms.Form): Username=forms.CharField(label='Username') Password=forms.CharField(label='Password', widget=forms.PasswordInput)
def clean_Username(self): user=self.cleaned_data['Username'] try: SOFIALogin.objects.get(UserName=user) except Exception: raise forms.ValidationError('Username invalid...')
def clean_Password(self): upass=self.cleaned_data['Password']
In the clean_Password method i wish to check if the password entered for the valid username is correct... So i need to get the Username value... How can i access this in clean_Password method... Please assist!!!!
© Stack Overflow or respective owner