summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparth2012-04-12 12:44:48 +0530
committerparth2012-04-12 12:44:48 +0530
commit8033c75af75bf1893ce28db4a137a016f723f05a (patch)
treec8ccf895c8572525409d25274b0a08728e63ca62
parentccce1bf405911f7f504c3870342f338c6ed47429 (diff)
parent6d200a668a7e544d72454909fef0687455b95239 (diff)
downloadaloha-8033c75af75bf1893ce28db4a137a016f723f05a.tar.gz
aloha-8033c75af75bf1893ce28db4a137a016f723f05a.tar.bz2
aloha-8033c75af75bf1893ce28db4a137a016f723f05a.zip
Merge https://github.com/FOSSEE/aloha
-rw-r--r--aloha/allotter/views.py40
-rw-r--r--aloha/template/allotter/complete.html5
2 files changed, 27 insertions, 18 deletions
diff --git a/aloha/allotter/views.py b/aloha/allotter/views.py
index d94a1dc..c3fc804 100644
--- a/aloha/allotter/views.py
+++ b/aloha/allotter/views.py
@@ -214,28 +214,32 @@ def complete_allotment(request):
options_chosen = get_chosen_options(user)
context = {'username': reg_no, 'email': sec_email,
'options_chosen': options_chosen, 'quit_status': quit_status}
- ##Sending mail with allotment details
- admin = User.objects.get(pk=1)
- from_email = admin.email
- subject = "JAM 2012 admissions"
- content = "The following options were chosen by you \n \n"
- if options_chosen:
+ ##Sending mail with allotment details
+
+ if not quit_status:
+ admin = User.objects.get(pk=1) #getting admin user
+ from_email = admin.email
+ subject = "JAM 2012 admissions"
+ content = "The following options were chosen by you \n \n"
+ if options_chosen:
+ counter = 1
+ for option in options_chosen:
+ content += "Preference Number: %s, Option Code: %s, Option Name: %s, Location: %s \n" % (counter, option.opt_code, option.opt_name, option.opt_location)
+ counter += 1
+
+ content += "\n \n \nPlease do not delete this email and keep it for reference purposes. \
+ \n \n \n \n Regards, \n JAM Office, IIT Bombay"
+ send_mail(subject, content, from_email, [sec_email], fail_silently=True)
+ admin_content = content
+ admin_content +="\n\n\n#%s:" % (reg_no)
counter = 1
for option in options_chosen:
- content += "Preference Number: %s, Option Code: %s, Option Name: %s, Location: %s \n" %(counter, option.opt_code, option.opt_name, option.opt_location)
- counter += 1
-
- content += "\n \n \nPlease do not delete this email and keep it for reference purposes. \n \n \n \n Regards, \n JAM Office, IIT Bombay"
- send_mail(subject, content, from_email, [sec_email], fail_silently=True)
- admin_content = content
- admin_content +="\n\n\n#%s:" % (reg_no)
- counter = 1
- for option in options_chosen:
admin_content += "%s,%s:" %(counter, option.opt_code)
counter += 1
- admin_content +="#"
- admin_content += time.ctime()
- mail_admins(subject, admin_content, fail_silently=True)
+ admin_content +="#"
+ admin_content += time.ctime()
+ mail_admins(subject, admin_content, fail_silently=True)
+
return render(request, 'allotter/complete.html', context)
diff --git a/aloha/template/allotter/complete.html b/aloha/template/allotter/complete.html
index bf2306f..01c884b 100644
--- a/aloha/template/allotter/complete.html
+++ b/aloha/template/allotter/complete.html
@@ -45,10 +45,15 @@ and re-submit your choices.</h3>
{% if email %}
+{% if not quit_status %}
+
An email with the selected list of options has been sent to {{ email }} for reference.
{% endif %}
+
+{% endif %}
+
{% else %}
<p><h4> No Options were chosen, click <b>Edit Options</b> to go back and select