From e7f3f0436555251577f61c93f2e7c1a99c9028a1 Mon Sep 17 00:00:00 2001 From: jayparikh111 Date: Tue, 31 Jan 2012 19:45:00 +0530 Subject: Updated forms.py to handle and exception when username or password fields are kept blank --- testapp/exam/forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'testapp') diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py index a5ca26f..d99a04d 100644 --- a/testapp/exam/forms.py +++ b/testapp/exam/forms.py @@ -85,8 +85,11 @@ class UserLoginForm(forms.Form): def clean(self): super(UserLoginForm, self).clean() - u_name, pwd = self.cleaned_data["username"], self.cleaned_data["password"] - user = authenticate(username = u_name, password = pwd) + try: + u_name, pwd = self.cleaned_data["username"], self.cleaned_data["password"] + user = authenticate(username = u_name, password = pwd) + except Exception: + raise forms.ValidationError("Username and/or Password is not entered") if not user: raise forms.ValidationError("Invalid username/password") -- cgit From 5aa7fb163af95c27bb3aea4a1dee75ef406e0582 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 1 Feb 2012 10:32:30 +0530 Subject: Updated Introduction form with new look --- testapp/templates/exam/intro.html | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'testapp') diff --git a/testapp/templates/exam/intro.html b/testapp/templates/exam/intro.html index 1d3e5de..2306fb7 100644 --- a/testapp/templates/exam/intro.html +++ b/testapp/templates/exam/intro.html @@ -3,7 +3,16 @@ {% block title %}Instructions and Rules {% endblock %} {% block content %} -

Important rules and instructions

+ + +
+
+ +
+
+

Important instructions & rules


Welcome {{user.first_name.title}} {{user.last_name.title}}, to the programming quiz!

@@ -43,11 +52,23 @@ carefully. -

We hope you enjoy taking this exam.

+

We hope you enjoy taking this exam !!!

{% csrf_token %} - +
+
+
+
+
+ -{% endblock content %} \ No newline at end of file +
+ + + + +{% endblock content %} -- cgit