summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparth2012-04-02 17:31:34 +0530
committerparth2012-04-02 17:31:34 +0530
commit08023c8c8a1aba7aca18be9ac0e6c435b988dad5 (patch)
tree327084b7b599b6aa4484a31df090ef60b9b632e6
parent6b072767edd13e642c341045ede4ea800edc97d9 (diff)
parent3ca2ba72b02e35395faf4599258f5454e840bfc1 (diff)
downloadaloha-08023c8c8a1aba7aca18be9ac0e6c435b988dad5.tar.gz
aloha-08023c8c8a1aba7aca18be9ac0e6c435b988dad5.tar.bz2
aloha-08023c8c8a1aba7aca18be9ac0e6c435b988dad5.zip
Merge branch 'master' of github.com:FOSSEE/aloha
-rw-r--r--.gitignore5
-rw-r--r--aloha/allotter/forms.py23
-rw-r--r--aloha/allotter/urls.py10
-rw-r--r--aloha/allotter/views.py31
-rw-r--r--aloha/production.py18
-rw-r--r--aloha/settings.py10
-rw-r--r--aloha/template/about.html26
-rw-r--r--aloha/template/allotter/apply.html4
-rw-r--r--aloha/template/allotter/complete.html4
-rw-r--r--aloha/template/allotter/login.html2
-rw-r--r--aloha/template/base.html4
-rw-r--r--aloha/urls.py1
-rw-r--r--docs/course_code_names.txt1
-rw-r--r--docs/paper_course_code_eligibility.txt2
14 files changed, 87 insertions, 54 deletions
diff --git a/.gitignore b/.gitignore
index a195837..846817e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,8 @@ parts/
develop-eggs/
bin/
.installed.cfg
+*csv
+*.tar.gz
+*.txt
+
+
diff --git a/aloha/allotter/forms.py b/aloha/allotter/forms.py
index 626698f..cd79b0e 100644
--- a/aloha/allotter/forms.py
+++ b/aloha/allotter/forms.py
@@ -12,7 +12,7 @@ from crispy_forms.layout import Submit
from string import digits, uppercase
BIRTH_YEAR_CHOICES = tuple(range(1960, 1994, 1))
-DD_YEAR_CHOICES = (2011, 2012)
+DD_YEAR_CHOICES = (2012,)
class UserLoginForm(forms.Form):
@@ -30,7 +30,7 @@ class UserLoginForm(forms.Form):
initial=datetime.date.today)
dd_no = forms.CharField(label="Demand Draft Number",
- max_length=10, help_text="Valid DD Number")
+ max_length=6, help_text="Valid DD Number")
dd_date = forms.DateField(label="Date of Issue",
help_text="Please ensure that Demand Draft is valid",
@@ -90,14 +90,13 @@ class UserLoginForm(forms.Form):
##Validating the DD Details
- if dd_no and dd_amount:
- if dd_no.strip(digits+uppercase):
- raise forms.ValidationError("Not a valid Demand Draft Number")
- elif dd_amount != 300:
- raise forms.ValidationError("Make sure the amount matches what is mentioned in brochure")
+ if not dd_no and not dd_amount:
+ raise forms.ValidationError("Fill in the Demand Draft Details")
+ elif len(dd_no) != 6 or dd_no.count('0') == 6 or dd_no.strip(digits):
+ raise forms.ValidationError("Demand Draft Number you have entered is not valid.")
+ if dd_amount != 300:
+ raise forms.ValidationError("Make sure the amount matches what is mentioned in brochure")
- else:
- raise forms.ValidationError("Fill in the Demand Draft Details")
##Authentication part
user = authenticate(username = u_name, password = pwd)
@@ -126,15 +125,15 @@ class UserDetailsForm(forms.Form):
self.helper.form_id = 'id-detailsform'
self.helper.form_method = 'post'
self.helper.form_class = 'form-horizontal'
- self.helper.form_action = "/allotter/"+user.username+"/details/"
+ self.helper.form_action = "/allotter/details/"
self.helper.add_input(Submit('submit', 'Submit'))
super(UserDetailsForm, self).__init__(*args, **kwargs)
email = forms.EmailField(label="Email Address", widget=forms.TextInput(attrs={"placeholder":"john@example.com",}),
help_text="Enter a valid email id where you will able to receive correspondence from JAM 2012.")
- phone_number = forms.CharField(label="Phone number", max_length=15, widget=forms.TextInput(attrs={"placeholder":"9876543210",}), help_text="Phone number with code")
+ phone_number = forms.CharField(label="Phone number", max_length=15, widget=forms.TextInput(attrs={"placeholder":"9876543210",}), help_text="Phone number with code. For example 02225722545 (with neither spaces nor dashes)")
- cat_check = forms.BooleanField(required=False, initial=False, label="Check this if you belong to SEBC Category")
+ cat_check = forms.BooleanField(required=False, initial=False, label="Check this if you belong to SEBC-M Category")
def clean_phone_number(self):
pno = self.cleaned_data['phone_number']
diff --git a/aloha/allotter/urls.py b/aloha/allotter/urls.py
index bb1d16a..0d3c334 100644
--- a/aloha/allotter/urls.py
+++ b/aloha/allotter/urls.py
@@ -3,10 +3,10 @@ from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('allotter.views',
url(r'^login/$', 'user_login'),
url(r'^logout/$', 'user_logout'),
- url(r'^(?P<reg_no>\d+)/apply/$', 'apply'),
- url(r'^(?P<reg_no>\d+)/details/$', 'submit_details'),
- url(r'^(?P<reg_no>\d+)/get_pdf/$', 'generate_pdf'),
- url(r'^(?P<reg_no>\d+)/submit/$', 'submit_options', name='submit_options'),
- url(r'^(?P<reg_no>\d+)/complete/$', 'complete_allotment', name='complete_allotment'),
+ url(r'^apply/$', 'apply'),
+ url(r'^details/$', 'submit_details'),
+ url(r'^get_pdf/$', 'generate_pdf'),
+ url(r'^submit/$', 'submit_options', name='submit_options'),
+ url(r'^complete/$', 'complete_allotment', name='complete_allotment'),
url(r'^$', 'user_login'),
)
diff --git a/aloha/allotter/views.py b/aloha/allotter/views.py
index 10daec8..4ebf7dd 100644
--- a/aloha/allotter/views.py
+++ b/aloha/allotter/views.py
@@ -33,9 +33,9 @@ def user_login(request):
if user.is_authenticated():
status = user.get_profile().application.submitted #Getting the submission status
if status: #If already submitted, takes to Completion Page
- return HttpResponseRedirect(reverse('allotter.views.complete_allotment', args=(user.username,)))
- else: #Otherwise to Option Choosing Page
- return HttpResponseRedirect(reverse('allotter.views.apply', args=(user.username,)))
+ return redirect('/allotter/complete/')
+ else: #Otherwise to Details Submission form
+ return redirect('/allotter/details/')
if request.method == "POST":
form = UserLoginForm(request.POST)
@@ -44,9 +44,9 @@ def user_login(request):
login(request, user)
status = user.get_profile().application.submitted #Getting the submission status
if status:
- return HttpResponseRedirect(reverse('allotter.views.complete_allotment', args=(user.username,)))
+ return redirect('/allotter/complete/') #Redirect to Completion Page
else:
- return HttpResponseRedirect(reverse('allotter.views.submit_details', args=(user.username,)))
+ return redirect('/allotter/details/') #Redirect to user details submission
else:
context = {"form": form}
return render(request, 'allotter/login.html', context)
@@ -57,7 +57,7 @@ def user_login(request):
@login_required
-def submit_details(request, reg_no):
+def submit_details(request):
"""
Get the secondary email address, phone number and save it to the Profile.
"""
@@ -71,7 +71,7 @@ def submit_details(request, reg_no):
if form.is_valid():
data = form.cleaned_data
form.save()
- return HttpResponseRedirect(reverse('allotter.views.apply', args=(user.username,)))
+ return redirect('/allotter/apply/') #Details submitted, taken to application page
else:
return render(request, 'allotter/details.html', {'form':form})
@@ -113,7 +113,7 @@ def get_details(user, error_message = ""):
return context
@login_required
-def apply(request, reg_no):
+def apply(request):
"""
Displays the application page for an authenticated user.
"""
@@ -140,12 +140,13 @@ def rem_dup(seq):
#TODO: Extensive Testing
@login_required
-def submit_options(request, reg_no):
+def submit_options(request):
"""
Gets the Options and their preference number through the POST object and
stores them as list(sorted according to preferences). Options with None are
ignored.
"""
+ reg_no = request.user.username
user = get_object_or_404(User, username=reg_no)
user_profile = user.get_profile()
user_application = user_profile.application
@@ -176,13 +177,14 @@ def submit_options(request, reg_no):
user_application.options_selected = options_code_list #Saving the data in model
user_application.submitted = True #Submission Status
user_application.save()
- return HttpResponseRedirect(reverse('allotter.views.complete_allotment', args=(reg_no,)))
+ return redirect('/allotter/complete/')
-def complete_allotment(request, reg_no):
+def complete_allotment(request):
"""
Passes the chosen options queryset to the Completion Page Template
"""
+ reg_no = request.user.username
user = get_object_or_404(User, username=reg_no)
sec_email = user.get_profile().secondary_email
options_chosen = get_chosen_options(user)
@@ -200,6 +202,7 @@ def complete_allotment(request, reg_no):
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])
admin_content = content
admin_content +="\n\n\n#%s:" % (reg_no)
counter = 1
@@ -207,7 +210,7 @@ def complete_allotment(request, reg_no):
content += "%s,%s:" %(counter, option.opt_code)
counter += 1
admin_content +="#"
- send_mail(subject, content, from_email, [sec_email])
+ admin_content += time.ctime()
mail_admins(subject, admin_content)
return render(request, 'allotter/complete.html', context)
@@ -227,11 +230,11 @@ def get_chosen_options(user):
@login_required
-def generate_pdf(request, reg_no):
+def generate_pdf(request):
"""
The Ugly code for generating the pdf using ReportLab.
"""
-
+ reg_no = request.user.username
user = get_object_or_404(User, username=reg_no)
user_profile = user.get_profile()
user_application = user_profile.application
diff --git a/aloha/production.py b/aloha/production.py
index 68f1306..b101d12 100644
--- a/aloha/production.py
+++ b/aloha/production.py
@@ -3,11 +3,13 @@ from aloha.settings import *
DEBUG=False
TEMPLATE_DEBUG=DEBUG
-
-DATABASES["default"]["ENGINE"] = 'django.db.backends.mysql'
-DATABASES["default"]["NAME"] = ''
-DATABASES["default"]["USER"] = ''
-
-from aloha.local import DATABASE_PASSWORD
-# Imports DATABASE_PASSWORD from testapp/local.py that is not part of git repo
-DATABASES["default"]["PASSWORD"] = DATABASE_PASSWORD
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': 'jamallotment', # Or path to database file if using sqlite3.
+ 'USER': 'jam_user', # Not used with sqlite3.
+ 'PASSWORD': 'Jam@2012Fossee', # Not used with sqlite3.
+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
diff --git a/aloha/settings.py b/aloha/settings.py
index a1052d9..de45eaa 100644
--- a/aloha/settings.py
+++ b/aloha/settings.py
@@ -7,8 +7,7 @@ DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
- ('Primal Pappachan', 'primal@fossee.in'),
- ('Parth Buch', 'parth.buch.115@gmail.com'),
+ ('JAM Admissions 2012', 'gate3@iitb.ac.in'),
)
AUTHORS = (
@@ -170,12 +169,11 @@ EMAIL_HOST = 'smtp-auth.iitb.ac.in'
# Port for sending e-mail.
EMAIL_PORT = '25'
-EMAIL_PORT = ""
# Optional SMTP authentication information for EMAIL_HOST.
-EMAIL_HOST_USER = ''
-EMAIL_HOST_PASSWORD = ''
-EMAIL_USE_TLS = False
+EMAIL_HOST_USER = 'gate3'
+EMAIL_HOST_PASSWORD = 'inter7384'
+EMAIL_USE_TLS = True
diff --git a/aloha/template/about.html b/aloha/template/about.html
new file mode 100644
index 0000000..40bb850
--- /dev/null
+++ b/aloha/template/about.html
@@ -0,0 +1,26 @@
+{% extends "base.html" %}
+
+{% block title %} Our Platform {% endblock %}
+
+{% block content %}
+<h2> The software powering our application are</h2> <br/>
+<h2>Parts of our platform relies on the following tools and source code.</h2>
+<hr />
+
+<ul>
+<li>Python 2.7 - Python Software Foundation Licensed under PSF License. </li>
+<li>Django 1.3 - Django Project Licensed under Open source, BSD License.</li>
+<li>Twitter Bootstrap CSS Tools - Twitter, Inc. Licensed under the Apache License v2.0.</li>
+<li>jQuery Javascript Library - John Resig. Licensed under the MIT License.</li>
+<li>ReportLab - ReportLab, Inc. Licensed under the BSD License.</li>
+<li>django-crispy-forms - Miguel Araujo, https://github.com/maraujop/django-crispy-forms </li>
+</ul>
+
+We also use the following icon-sets
+<ul>
+<li></li>
+</ul>
+
+
+{% endblock content %}
+
diff --git a/aloha/template/allotter/apply.html b/aloha/template/allotter/apply.html
index fc9b930..e6958dc 100644
--- a/aloha/template/allotter/apply.html
+++ b/aloha/template/allotter/apply.html
@@ -9,7 +9,7 @@ $(document).ready(function(){
if(($.browser.msie) && ($.browser.version <=8)){
window.location="/browser-version"
}
- if(($.browser.mozilla) && (parseInt($.browser.version) <=7)){
+ if(($.browser.mozilla) && (parseInt($.browser.version) <=5)){
window.location="/browser-version"
}
if(($.browser.webkit) && (parseInt($.browser.version <=530))){
@@ -100,7 +100,7 @@ Listing the options for first test paper.
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
-<form action="/allotter/{{user.username}}/submit/" method="post">
+<form action="/allotter/submit/" method="post">
{% csrf_token %}
<table class="table table-bordered table-striped">
diff --git a/aloha/template/allotter/complete.html b/aloha/template/allotter/complete.html
index 34939f4..1b87da7 100644
--- a/aloha/template/allotter/complete.html
+++ b/aloha/template/allotter/complete.html
@@ -59,7 +59,7 @@ options otherwise click <b>Quit Allotment</b> to exit the allotment process </h3
<br/>
<p>You may edit your options by clicking <b>Edit Options</b>. <i>Please keep in mind that your previous options
will be deleted.</i></p>
-<form id="apply" action="/allotter/{{username}}/apply/" method="post">
+<form id="apply" action="/allotter/apply/" method="post">
{% csrf_token %}
<input type="submit" name="apply" value="Edit Options" class="btn" />
</form>
@@ -72,7 +72,7 @@ will be deleted.</i></p>
<p>Click on the button <b>Generate Allotment PDF</b> to generate a Portable Document
Format(PDF) of your options. Take a print out of this PDF and send it with
your completed application form to the Organizing chairman </p>
-<form id ="get_pdf" action="/allotter/{{username}}/get_pdf/" method="post">
+<form id ="get_pdf" action="/allotter/get_pdf/" method="post">
{% csrf_token %}
<input type="submit" name="get_pdf" value="Generate Allotment PDF" class="btn" />
</form>
diff --git a/aloha/template/allotter/login.html b/aloha/template/allotter/login.html
index 8f7e755..ca8dc57 100644
--- a/aloha/template/allotter/login.html
+++ b/aloha/template/allotter/login.html
@@ -8,7 +8,7 @@ $(document).ready(function(){
if(($.browser.msie) && ($.browser.version <=8)){
window.location="/browser-version"
}
- if(($.browser.mozilla) && (parseInt($.browser.version) <=7)){
+ if(($.browser.mozilla) && (parseInt($.browser.version) <=5)){
window.location="/browser-version"
}
if(($.browser.webkit) && (parseInt($.browser.version <=530))){
diff --git a/aloha/template/base.html b/aloha/template/base.html
index 9c536de..32ae0df 100644
--- a/aloha/template/base.html
+++ b/aloha/template/base.html
@@ -42,7 +42,6 @@
<a class="brand" href="#">JAM 2012</a>
<div class="nav-collapse">
<ul class="nav">
- <li class="active"><a href="#">Home</a></li>
<li><a href="http://www.iitb.ac.in/~pge/2k12/jam/faq.html" target="_blank">FAQs</a></li>
<li><a href="http://www.iitb.ac.in/~pge/2k12/jam/contact.html" target="_blank">Contact</a></li>
</ul>
@@ -84,7 +83,8 @@
</div>
</div>
<footer>
- <p>Copyright &copy; 2012 <a href="http://fossee.in">FOSSEE</a> for IIT Bombay</p>
+ <p class="pull-right"><a href="/about">About the software platform</a></p>
+ <p>Copyright &copy; 2012 <a href="http://fossee.in">FOSSEE</a> for GATE-JAM Office, IIT Bombay </p>
</footer>
</div> <!-- /container -->
diff --git a/aloha/urls.py b/aloha/urls.py
index f93b16b..3738f07 100644
--- a/aloha/urls.py
+++ b/aloha/urls.py
@@ -11,6 +11,7 @@ admin.autodiscover()
urlpatterns = patterns('',
url(r'^allotter/', include('allotter.urls')),
url(r'^browser-version', direct_to_template, {'template': 'browser-version.html'}),
+ url(r'^about', direct_to_template, {'template': 'about.html'}),
url(r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /", mimetype="text/plain")),
# Examples:
# url(r'^$', 'aloha.views.home', name='home'),
diff --git a/docs/course_code_names.txt b/docs/course_code_names.txt
index a576df1..48f576f 100644
--- a/docs/course_code_names.txt
+++ b/docs/course_code_names.txt
@@ -27,7 +27,6 @@
405:M.Sc.-Ph.D. Dual Degree in Physics:IIT Kanpur
501:Joint M.Sc.-Ph.D. Programme in Chemistry:IIT Kharagpur
502:Joint M.Sc.-Ph.D. Programme in Geology:IIT Kharagpur
-503:Joint M.Sc.-Ph.D. Programme in Geophysics:IIT Kharagpur
504:Joint M.Sc.-Ph.D. Programme in Mathematics:IIT Kharagpur
505:Joint M.Sc.-Ph.D. Programme in Physics:IIT Kharagpur
601:M.Sc. Chemistry (4 Semesters):IIT Madras
diff --git a/docs/paper_course_code_eligibility.txt b/docs/paper_course_code_eligibility.txt
index 4f8c8e1..5b5009b 100644
--- a/docs/paper_course_code_eligibility.txt
+++ b/docs/paper_course_code_eligibility.txt
@@ -2,7 +2,7 @@ BT:104:110:113:703
CA:709
CY:105:111:112:113:201:301:401:501:601:704:801
GG:101:108:502:701:707
-GP:102:109:503:708
+GP:102:109:708
MA:106:112:113:114:202:302:402:504:602:702:705
MS:103:114:404
PH:107:112:113:115:116:203:303:403:405:505:603:706:802