clean method for validation
- by apoorva
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!!!!