Changes to the data model for including blank districts.
--- a/app/projrev/models.py Mon Aug 10 19:38:53 2009 +0530
+++ b/app/projrev/models.py Tue Aug 11 03:38:51 2009 +0530
@@ -718,12 +718,13 @@
# to in the state of India.
district = models.CharField(max_length=256,
choices=sort_dict(DISTRICT_CHOICES),
- null=True)
+ null=True, blank=True)
district.help_text = ('First select the state before selecting the district. '
'Select the district of the state where this project is taken up.')
- mobile_num = models.CharField(max_length=20)
- mobile_num.help_text = 'Enter your mobile number.'
+ phone_num = models.CharField(max_length=20)
+ phone_num.verbose_name = 'Phone Number'
+ phone_num.help_text = 'Enter your mobile number.'
fax_num = models.CharField(max_length=20, null=True, blank=True)
fax_num.help_text = 'Enter your fax number with the code.'
@@ -785,7 +786,10 @@
"""Get the District name from its code.
"""
- return cls.DISTRICT_CHOICES[code]
+ if code in cls.DISTRICT_CHOICES:
+ return cls.DISTRICT_CHOICES[code]
+ else:
+ return None
@classmethod
def getDistrictCode(cls, name):
@@ -871,6 +875,7 @@
#: Field containing the comment entered along with the review.
comment = models.TextField()
+ comment.verbose_name = 'Overall Comment'
comment.help_text = "Enter your review comment about this proposal."
#: Field representing the reference to the person who
@@ -886,41 +891,77 @@
attribute1.verbose_name = ('Feasibility of the proposed activity and the '
'appropriateness of the time frame.')
+ comment_a1 = models.TextField(blank=True)
+ comment_a1.verbose_name = 'Comment'
+ comment_a1.help_text = "Comment for this attribute."
+
attribute2 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute2.verbose_name = ('Uniqueness/novelty/innovation of the said '
'proposal')
+ comment_a2 = models.TextField(blank=True)
+ comment_a2.verbose_name = 'Comment'
+ comment_a2.help_text = "Comment for this attribute."
+
attribute3 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute3.verbose_name = ('Scope for inter-institutional collaboration and '
'development.')
+ comment_a3 = models.TextField(blank=True)
+ comment_a3.verbose_name = 'Comment'
+ comment_a3.help_text = "Comment for this attribute."
+
attribute4 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute4.verbose_name = ('The organisation of the programme to be carried '
'out.')
+ comment_a4 = models.TextField(blank=True)
+ comment_a4.verbose_name = 'Comment'
+ comment_a4.help_text = "Comment for this attribute."
+
attribute5 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute5.verbose_name = ('The details of the work as the outlined by the '
'principal investigator(PI).')
+ comment_a5 = models.TextField(blank=True)
+ comment_a5.verbose_name = 'Comment'
+ comment_a5.help_text = "Comment for this attribute."
+
attribute6 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute6.verbose_name = ('Sufficiency of funds as requested by the PI.')
+ comment_a6 = models.TextField(blank=True)
+ comment_a6.verbose_name = 'Comment'
+ comment_a6.help_text = "Comment for this attribute."
+
attribute7 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute7.verbose_name = ('Social impact/reach/spread of the outcome of the '
'proposal.')
+ comment_a7 = models.TextField(blank=True)
+ comment_a7.verbose_name = 'Comment'
+ comment_a7.help_text = "Comment for this attribute."
+
attribute8 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute8.verbose_name = ('Contribution of the proposal to minimizing the '
'digital divide in our country.')
+ comment_a8 = models.TextField(blank=True)
+ comment_a8.verbose_name = 'Comment'
+ comment_a8.help_text = "Comment for this attribute."
+
attribute9 = models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
attribute9.verbose_name = ('Any other matter which is likely to affect the '
'execution of the project(max 600 characters).')
+
+ comment_a9 = models.TextField(blank=True)
+ comment_a9.verbose_name = 'Comment'
+ comment_a9.help_text = "Comment for this attribute."
--- a/app/projrev/views/helpers/forms.py Mon Aug 10 19:38:53 2009 +0530
+++ b/app/projrev/views/helpers/forms.py Tue Aug 11 03:38:51 2009 +0530
@@ -28,7 +28,7 @@
# fields in the Project that must not appear in the form, but have
# be automatically generated.
fields = ('title', 'line_item', 'institution', 'address', 'city',
- 'pin_code', 'state', 'district', 'mobile_num', 'fax_num')
+ 'pin_code', 'state', 'district', 'phone_num', 'fax_num')
class ReviewForm(forms.ModelForm):
--- a/app/projrev/views/proposal.py Mon Aug 10 19:38:53 2009 +0530
+++ b/app/projrev/views/proposal.py Tue Aug 11 03:38:51 2009 +0530
@@ -97,9 +97,14 @@
project.district = Project.getDistrict(cleaned_data['district'])
else:
# Generate MICR code
- cleaned_data['micr_code'] = '%s%s%d' % (
- cleaned_data['district'], cleaned_data['line_item'],
- int(time.time() * 1000) % 1000000000)
+ if cleaned_data['district']:
+ cleaned_data['micr_code'] = '%s%s%d' % (
+ cleaned_data['district'], cleaned_data['line_item'],
+ int(time.time() * 1000) % 1000000000)
+ else:
+ cleaned_data['micr_code'] = '%s%s%s%d' % (
+ cleaned_data['state'], 'NN', cleaned_data['line_item'],
+ int(time.time() * 1000) % 1000000000)
cleaned_data['line_item'] = Project.getLineItem(cleaned_data['line_item'])
cleaned_data['state'] = Project.getState(cleaned_data['state'])
@@ -279,16 +284,18 @@
context['form'] = rev_form
context['project'] = project
- proposal = project.proposal_set.all().order_by('-submitted_on')[0]
-
- if proposal:
- proposal_path = str(proposal.document)
+ proposals = project.proposal_set.all().order_by('-submitted_on')
+ if proposals:
+ proposal = proposals[0]
- proposal_name = proposal_path.split('/')[-1]
+ if proposal:
+ proposal_path = str(proposal.document)
- context['proposal_path'] = proposal_path
- context['proposal_name'] = proposal_name
- context['last_submitted'] = proposal.submitted_on
+ proposal_name = proposal_path.split('/')[-1]
+
+ context['proposal_path'] = proposal_path
+ context['proposal_name'] = proposal_name
+ context['last_submitted'] = proposal.submitted_on
reviews = project.review_set.all().order_by('reviewed_on')
if reviews:
@@ -318,16 +325,18 @@
project = Project.objects.get(micr_code=micr_code)
- proposal = project.proposal_set.all().order_by('-submitted_on')[0]
-
- if proposal:
- proposal_path = str(proposal.document)
+ proposals = project.proposal_set.all().order_by('-submitted_on')
+ if proposals:
+ proposal = proposals[0]
- proposal_name = proposal_path.split('/')[-1]
+ if proposal:
+ proposal_path = str(proposal.document)
- context['proposal_path'] = proposal_path
- context['proposal_name'] = proposal_name
- context['last_submitted'] = proposal.submitted_on
+ proposal_name = proposal_path.split('/')[-1]
+
+ context['proposal_path'] = proposal_path
+ context['proposal_name'] = proposal_name
+ context['last_submitted'] = proposal.submitted_on
# Get all the reviews and put them to context.
reviews = project.review_set.all().order_by('reviewed_on')
--- a/app/site-content/css/jquery.rating.css Mon Aug 10 19:38:53 2009 +0530
+++ b/app/site-content/css/jquery.rating.css Tue Aug 11 03:38:51 2009 +0530
@@ -56,14 +56,3 @@
overflow:hidden!important
}
/* END jQuery.Rating Plugin CSS */
-
-label {
- float: left;
- width: 40%;
- position: relative;
- top: -5px;
- font-weight:bold;
- margin:5px 0;
- margin-right: 1em;
- text-align: right;
-}
\ No newline at end of file
--- a/app/site-content/css/projrev.css Mon Aug 10 19:38:53 2009 +0530
+++ b/app/site-content/css/projrev.css Tue Aug 11 03:38:51 2009 +0530
@@ -495,3 +495,23 @@
font: normal 1em "Trebuchet MS", Tahoma, sans-serif;
color:#f00;
}
+
+label#id_comment {
+ float: left;
+ width: 12%;
+ font-weight:bold;
+ margin:5px 0;
+ margin-right: 1em;
+ text-align: right;
+}
+
+textarea#id_comment_a1, textarea#id_comment_a2, textarea#id_comment_a3, textarea#id_comment_a4, textarea#id_comment_a5, textarea#id_comment_a6, textarea#id_comment_a7, textarea#id_comment_a8, textarea#id_comment_a9, textarea#id_comment {
+ width:70%;
+ margin-left: 3%;
+ padding:3px;
+ font: normal 1em "Trebuchet MS", Tahoma, sans-serif;
+ border:1px solid #eee;
+ height:100px;
+ display:inline;
+ color:#777;
+}
\ No newline at end of file
--- a/app/templates/projrev/proposal/list.html Mon Aug 10 19:38:53 2009 +0530
+++ b/app/templates/projrev/proposal/list.html Tue Aug 11 03:38:51 2009 +0530
@@ -5,6 +5,7 @@
<table>
<tr>
<th class="first">MICR Code</th>
+ <th>Title</th>
<th>Line Item</th>
<th>Institution</th>
<th>State</th>
@@ -13,6 +14,7 @@
{% for project in projects %}
<tr class="row-a"><td><a href='{{ row_url }}{{ project.micr_code }}'>
{{ project.micr_code }}</td>
+ <td>{{ project.title }}</td>
<td>{{ project.line_item }}</td>
<td>{{ project.institution }}</td>
<td>{{ project.state }}</td>
--- a/app/templates/projrev/proposal/rank.html Mon Aug 10 19:38:53 2009 +0530
+++ b/app/templates/projrev/proposal/rank.html Tue Aug 11 03:38:51 2009 +0530
@@ -11,6 +11,13 @@
<div class='review-center-box'>
<div class='review-left'>
+ Title:
+ </div>
+ <div class='review-right'>
+ {{ project.title }}
+ </div>
+ <br/>
+ <div class='review-left'>
Project MICR Code:
</div>
<div class='review-right'>
@@ -32,6 +39,27 @@
</div>
<br/>
<div class='review-left'>
+ Address:
+ </div>
+ <div class='review-right'>
+ {{ project.address }}
+ </div>
+ <br/>
+ <div class='review-left'>
+ City:
+ </div>
+ <div class='review-right'>
+ {{ project.city }}
+ </div>
+ <br/>
+ <div class='review-left'>
+ PIN Code:
+ </div>
+ <div class='review-right'>
+ {{ project.pin_code }}
+ </div>
+ <br/>
+ <div class='review-left'>
State:
</div>
<div class='review-right'>
@@ -51,6 +79,7 @@
<div class='review-right'>
<a href="/site-content/{{ proposal_path }}">{{ proposal_name }}</a>
</div>
+ <br />
</div>
<p class="post-footer align-right">
--- a/app/templates/projrev/proposal/review.html Mon Aug 10 19:38:53 2009 +0530
+++ b/app/templates/projrev/proposal/review.html Tue Aug 11 03:38:51 2009 +0530
@@ -89,12 +89,140 @@
<div class='review-right'>
<a href="/site-content/{{ proposal_path }}">{{ proposal_name }}</a>
</div>
+ <br />
</div>
<form enctype="multipart/form-data" method="post" action="">
<p>
<p>
+ {{ form.attribute1.errors }}
+ <strong>{{ form.attribute1.label }}</strong><br />
+ <input id="attribute1" name="attribute1" type="radio" class="star" value="1"/>
+ <input id="attribute1" name="attribute1" type="radio" class="star" value="2"/>
+ <input id="attribute1" name="attribute1" type="radio" class="star" value="3"/>
+ <input id="attribute1" name="attribute1" type="radio" class="star" value="4" />
+ <input id="attribute1" name="attribute1" type="radio" class="star" value="5"/>
+ {% if form.attribute1.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a1.errors }}
+ <label id='id_comment'>{{ form.comment_a1.label }}</label>{{ form.comment_a1 }}
+ </p>
+ <p>
+ {{ form.attribute2.errors }}
+ <strong>{{ form.attribute2.label }}</strong><br />
+ <input name="attribute2" type="radio" class="star" value="1"/>
+ <input name="attribute2" type="radio" class="star" value="2"/>
+ <input name="attribute2" type="radio" class="star" value="3"/>
+ <input name="attribute2" type="radio" class="star" value="4"/>
+ <input name="attribute2" type="radio" class="star" value="5"/>
+ {% if form.attribute2.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a2.errors }}
+ <label id='id_comment'>{{ form.comment_a2.label }}</label>{{ form.comment_a2 }}
+ </p>
+ <p>
+ {{ form.attribute3.errors }}
+ <strong>{{ form.attribute3.label }}</strong><br />
+ <input name="attribute3" type="radio" class="star" value="1"/>
+ <input name="attribute3" type="radio" class="star" value="2"/>
+ <input name="attribute3" type="radio" class="star" value="3"/>
+ <input name="attribute3" type="radio" class="star" value="4"/>
+ <input name="attribute3" type="radio" class="star" value="5"/>
+ {% if form.attribute3.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a3.errors }}
+ <label id='id_comment'>{{ form.comment_a3.label }}</label>{{ form.comment_a3 }}
+ </p>
+ <p>
+ {{ form.attribute4.errors }}
+ <strong>{{ form.attribute4.label }}</strong><br />
+ <input name="attribute4" type="radio" class="star" value="1"/>
+ <input name="attribute4" type="radio" class="star" value="2"/>
+ <input name="attribute4" type="radio" class="star" value="3"/>
+ <input name="attribute4" type="radio" class="star" value="4"/>
+ <input name="attribute4" type="radio" class="star" value="5"/>
+ {% if form.attribute4.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a4.errors }}
+ <label id='id_comment'>{{ form.comment_a4.label }}</label>{{ form.comment_a4 }}
+ </p>
+ <p>
+ {{ form.attribute5.errors }}
+ <strong>{{ form.attribute5.label }}</strong><br />
+ <input name="attribute5" type="radio" class="star" value="1"/>
+ <input name="attribute5" type="radio" class="star" value="2"/>
+ <input name="attribute5" type="radio" class="star" value="3"/>
+ <input name="attribute5" type="radio" class="star" value="4"/>
+ <input name="attribute5" type="radio" class="star" value="5"/>
+ {% if form.attribute5.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a5.errors }}
+ <label id='id_comment'>{{ form.comment_a5.label }}</label>{{ form.comment_a5 }}
+ </p>
+ <p>
+ {{ form.attribute6.errors }}
+ <strong>{{ form.attribute6.label }}</strong><br />
+ <input name="attribute6" type="radio" class="star" value="1"/>
+ <input name="attribute6" type="radio" class="star" value="2"/>
+ <input name="attribute6" type="radio" class="star" value="3"/>
+ <input name="attribute6" type="radio" class="star" value="4"/>
+ <input name="attribute6" type="radio" class="star" value="5"/>
+ {% if form.attribute6.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a6.errors }}
+ <label id='id_comment'>{{ form.comment_a6.label }}</label>{{ form.comment_a6 }}
+ </p>
+ <p>
+ {{ form.attribute7.errors }}
+ <strong>{{ form.attribute7.label }}</strong><br />
+ <input name="attribute7" type="radio" class="star" value="1"/>
+ <input name="attribute7" type="radio" class="star" value="2"/>
+ <input name="attribute7" type="radio" class="star" value="3"/>
+ <input name="attribute7" type="radio" class="star" value="4"/>
+ <input name="attribute7" type="radio" class="star" value="5"/>
+ {% if form.attribute7.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a7.errors }}
+ <label id='id_comment'>{{ form.comment_a7.label }}</label>{{ form.comment_a7 }}
+ </p>
+ <p>
+ {{ form.attribute8.errors }}
+ <strong>{{ form.attribute8.label }}</strong><br />
+ <input name="attribute8" type="radio" class="star" value="1"/>
+ <input name="attribute8" type="radio" class="star" value="2"/>
+ <input name="attribute8" type="radio" class="star" value="3"/>
+ <input name="attribute8" type="radio" class="star" value="4"/>
+ <input name="attribute8" type="radio" class="star" value="5"/>
+ {% if form.attribute8.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a8.errors }}
+ <label id='id_comment'>{{ form.comment_a8.label }}</label>{{ form.comment_a8 }}
+ </p>
+ <p>
+ {{ form.attribute9.errors }}
+ <strong>{{ form.attribute9.label }}</strong><br />
+ <input name="attribute9" type="radio" class="star" value="1"/>
+ <input name="attribute9" type="radio" class="star" value="2"/>
+ <input name="attribute9" type="radio" class="star" value="3"/>
+ <input name="attribute9" type="radio" class="star" value="4"/>
+ <input name="attribute9" type="radio" class="star" value="5"/>
+ {% if form.attribute9.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ </p>
+ <p>
+ {{ form.comment_a9.errors }}
+ <label id='id_comment'>{{ form.comment_a9.label }}</label>{{ form.comment_a9 }}
+ </p>
+ <br /><br />
+ <p>
{% if form.comment.help_text %}
<script type="text/javascript">
$(document).ready( function() {
@@ -146,97 +274,7 @@
</script>
{% endif %}
{{ form.comment.errors }}
- {{ form.comment.label_tag }}{{ form.comment }}{% if form.comment.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute1.errors }}
- {{ form.attribute1.label_tag }}
- <input id="attribute1" name="attribute1" type="radio" class="star" value="1"/>
- <input id="attribute1" name="attribute1" type="radio" class="star" value="2"/>
- <input id="attribute1" name="attribute1" type="radio" class="star" value="3"/>
- <input id="attribute1" name="attribute1" type="radio" class="star" value="4" />
- <input id="attribute1" name="attribute1" type="radio" class="star" value="5"/>
- {% if form.attribute1.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute2.errors }}
- {{ form.attribute2.label_tag }}
- <input name="attribute2" type="radio" class="star" value="1"/>
- <input name="attribute2" type="radio" class="star" value="2"/>
- <input name="attribute2" type="radio" class="star" value="3"/>
- <input name="attribute2" type="radio" class="star" value="4"/>
- <input name="attribute2" type="radio" class="star" value="5"/>
- {% if form.attribute2.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute3.errors }}
- {{ form.attribute3.label_tag }}
- <input name="attribute3" type="radio" class="star" value="1"/>
- <input name="attribute3" type="radio" class="star" value="2"/>
- <input name="attribute3" type="radio" class="star" value="3"/>
- <input name="attribute3" type="radio" class="star" value="4"/>
- <input name="attribute3" type="radio" class="star" value="5"/>
- {% if form.attribute3.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute4.errors }}
- {{ form.attribute4.label_tag }}
- <input name="attribute4" type="radio" class="star" value="1"/>
- <input name="attribute4" type="radio" class="star" value="2"/>
- <input name="attribute4" type="radio" class="star" value="3"/>
- <input name="attribute4" type="radio" class="star" value="4"/>
- <input name="attribute4" type="radio" class="star" value="5"/>
- {% if form.attribute4.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute5.errors }}
- {{ form.attribute5.label_tag }}
- <input name="attribute5" type="radio" class="star" value="1"/>
- <input name="attribute5" type="radio" class="star" value="2"/>
- <input name="attribute5" type="radio" class="star" value="3"/>
- <input name="attribute5" type="radio" class="star" value="4"/>
- <input name="attribute5" type="radio" class="star" value="5"/>
- {% if form.attribute5.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute6.errors }}
- {{ form.attribute6.label_tag }}
- <input name="attribute6" type="radio" class="star" value="1"/>
- <input name="attribute6" type="radio" class="star" value="2"/>
- <input name="attribute6" type="radio" class="star" value="3"/>
- <input name="attribute6" type="radio" class="star" value="4"/>
- <input name="attribute6" type="radio" class="star" value="5"/>
- {% if form.attribute6.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute7.errors }}
- {{ form.attribute7.label_tag }}
- <input name="attribute7" type="radio" class="star" value="1"/>
- <input name="attribute7" type="radio" class="star" value="2"/>
- <input name="attribute7" type="radio" class="star" value="3"/>
- <input name="attribute7" type="radio" class="star" value="4"/>
- <input name="attribute7" type="radio" class="star" value="5"/>
- {% if form.attribute7.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute8.errors }}
- {{ form.attribute8.label_tag }}
- <input name="attribute8" type="radio" class="star" value="1"/>
- <input name="attribute8" type="radio" class="star" value="2"/>
- <input name="attribute8" type="radio" class="star" value="3"/>
- <input name="attribute8" type="radio" class="star" value="4"/>
- <input name="attribute8" type="radio" class="star" value="5"/>
- {% if form.attribute8.field.required %}<span class="specialclass"> (required)</span>{% endif %}
- </p>
- <p>
- {{ form.attribute9.errors }}
- {{ form.attribute9.label_tag }}
- <input name="attribute9" type="radio" class="star" value="1"/>
- <input name="attribute9" type="radio" class="star" value="2"/>
- <input name="attribute9" type="radio" class="star" value="3"/>
- <input name="attribute9" type="radio" class="star" value="4"/>
- <input name="attribute9" type="radio" class="star" value="5"/>
- {% if form.attribute9.field.required %}<span class="specialclass"> (required)</span>{% endif %}
+ <label id='id_comment'>{{ form.comment.label }}</label>{{ form.comment }}{% if form.comment.field.required %}<span class="specialclass"> (required)</span>{% endif %}
</p>
<br />
<input class="button" type="submit" value="Submit Review" />