diff options
-rw-r--r-- | aloha/allotter/views.py | 18 | ||||
-rw-r--r-- | aloha/template/allotter/hello.html | 11 | ||||
-rw-r--r-- | aloha/template/allotter/logout.html | 22 |
3 files changed, 35 insertions, 16 deletions
diff --git a/aloha/allotter/views.py b/aloha/allotter/views.py index 9474de3..d94a1dc 100644 --- a/aloha/allotter/views.py +++ b/aloha/allotter/views.py @@ -137,8 +137,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": @@ -147,7 +150,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') #TODO: Extensive Testing @@ -176,8 +179,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 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 %} -<h2>Hello, there</h2> - -<p> Welcome <strong>{{user.first_name.title}} {{user.last_name.title}}</strong>, -to JAM 2012 allotment! </p> - -{% endblock content %} 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 %} +<h2>Your application has been succesfully submitted.</h2> +<hr /> +<h3>You can <a href="/allotter/login/">login</a> again to download the Application Form and the Allotment Form.</h3> +<hr /> +<p><b>For any queries please contact</b> +<br/> +Organizing Chairman, GATE - JAM Office<br/> +Indian Institute of Technology Bombay,<br/> +P.O. IIT Powai, MUMBAI - 400 076<br/> +Phone: 022-25767022, 25767068<br/> +Fax : 022-25722674<br/> +e-mail : jam[at]iitb.ac.in<br/> +Website : www.iitb.ac.in/jam +</p> +{% endblock content %} + |