I have a custom Django login page. I want to throw an exception when the username or password fields are empty. How can i do this?
My log.py login method:
def user_login(request): context = RequestContext(request) if request.method == 'POST':
I tried this and it did not work: This is form.py
def clean_username(self): username = self.cleaned_data.get('username') if not username: raise forms.ValidationError('username does not exist.')
python django validation login
chazefate
source share