From 31b6f7917ce1f6e7d8308d57c951ac670f37c250 Mon Sep 17 00:00:00 2001 From: parth Date: Thu, 12 Apr 2012 12:18:23 +0530 Subject: Fixed the value error on apply page --- aloha/allotter/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aloha/allotter/views.py b/aloha/allotter/views.py index c53abe3..a1091f5 100644 --- a/aloha/allotter/views.py +++ b/aloha/allotter/views.py @@ -172,8 +172,13 @@ def submit_options(request): options_chosen_list = [] #Initializing empty list for storing options for option in options_available_list: - option_pref = request.POST[unicode(option.opt_code)] - options_chosen_list.append([int(option_pref), str(option.opt_code)]) #[preference, option code] + option_pref = request.POST[unicode(option.opt_code)] + try: + options_chosen_list.append([int(option_pref), str(option.opt_code)]) #[preference, option code] + except ValueError: + context = get_details(user) + return render(request, 'allotter/apply.html', context) + options_chosen_list.sort() #Sorting by preference -- cgit From e087766a2da9daf6592a512aa55a17f4c75b588e Mon Sep 17 00:00:00 2001 From: parth Date: Thu, 12 Apr 2012 12:43:32 +0530 Subject: Logout View --- aloha/allotter/views.py | 9 ++++++--- aloha/template/allotter/logout.html | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 aloha/template/allotter/logout.html diff --git a/aloha/allotter/views.py b/aloha/allotter/views.py index a1091f5..de7cd92 100644 --- a/aloha/allotter/views.py +++ b/aloha/allotter/views.py @@ -127,8 +127,11 @@ def apply(request): def user_logout(request): ##Logouts the user. - quit_status = request.POST['check'] - user = request.user + try: + quit_status = request.POST['check'] + user = request.user + except : + return redirect('/allotter/login/') user_profile = user.get_profile() user_application = user_profile.application if str(quit_status) == "on": @@ -137,7 +140,7 @@ def user_logout(request): user_application.quit_status = False user_application.save() logout(request) - return redirect ('/allotter/login/') + return render(request, 'allotter/logout.html') ##http://stackoverflow.com/questions/480214/how-do-you-remove-duplicates-from-a-list-in-python-whilst-preserving-##order def rem_dup(seq): diff --git a/aloha/template/allotter/logout.html b/aloha/template/allotter/logout.html new file mode 100644 index 0000000..4632586 --- /dev/null +++ b/aloha/template/allotter/logout.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} + + +{% block title %}Application sucessfully submitted{% endblock title %} + +{% block content %} +

Your application has been succesfully submitted.

+
+

You can login again to download the Application Form and the Allotment Form.

+
+

For any queries please contact +
+Organizing Chairman, GATE - JAM Office
+Indian Institute of Technology Bombay,
+P.O. IIT Powai, MUMBAI - 400 076
+Phone: 022-25767022, 25767068
+Fax : 022-25722674
+e-mail : jam[at]iitb.ac.in
+Website : www.iitb.ac.in/jam +

+{% endblock content %} + -- cgit From 91f1f373beaff8a18dfb40fc0f8a7e7af160d9e0 Mon Sep 17 00:00:00 2001 From: parth Date: Thu, 12 Apr 2012 12:43:53 +0530 Subject: removed the hello.html --- aloha/template/allotter/hello.html | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 aloha/template/allotter/hello.html diff --git a/aloha/template/allotter/hello.html b/aloha/template/allotter/hello.html deleted file mode 100644 index 0d07c7f..0000000 --- a/aloha/template/allotter/hello.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.html" %} - -{% block title %} Welcome Note {% endblock %} - -{% block content %} -

Hello, there

- -

Welcome {{user.first_name.title}} {{user.last_name.title}}, -to JAM 2012 allotment!

- -{% endblock content %} -- cgit