# HG changeset patch # User Madhusudan.C.S # Date 1249913333 -19800 # Node ID 3cb38edbe05f899f29d4310892aa31af7252a86a # Parent e78a5483553e6d579829aee4252a4d2c3f02c74d Form changes. diff -r e78a5483553e -r 3cb38edbe05f app/projrev/models.py --- a/app/projrev/models.py Mon Aug 10 17:18:07 2009 +0530 +++ b/app/projrev/models.py Mon Aug 10 19:38:53 2009 +0530 @@ -692,6 +692,22 @@ institution = models.CharField(max_length=256) institution.help_text = 'Give the full name of your institution.' + # Field containing the title of the proposal + title = models.CharField(max_length=2000) + title.help_text = 'Give the complete title of your proposal.' + + # Field containing the title of the proposal + address = models.CharField(max_length=2000) + address.help_text = 'Enter your complete address.' + + # Field containing the city + city = models.CharField(max_length=1000) + city.help_text = 'Enter the city name.' + + # Field containing the pin code + pin_code = models.IntegerField() + pin_code.help_text = "Enter your address's pin code." + # Field containing the state to which the institution belongs to. state = models.CharField( max_length=256, @@ -701,7 +717,8 @@ # Field containing the district to which the institution belongs # to in the state of India. district = models.CharField(max_length=256, - choices=sort_dict(DISTRICT_CHOICES)) + choices=sort_dict(DISTRICT_CHOICES), + null=True) district.help_text = ('First select the state before selecting the district. ' 'Select the district of the state where this project is taken up.') @@ -868,42 +885,42 @@ choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) attribute1.verbose_name = ('Feasibility of the proposed activity and the ' 'appropriateness of the time frame.') - + attribute2 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('Uniqueness/novelty/innovation of the said ' + attribute2.verbose_name = ('Uniqueness/novelty/innovation of the said ' 'proposal') attribute3 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('Scope for inter-institutional collaboration and ' + attribute3.verbose_name = ('Scope for inter-institutional collaboration and ' 'development.') attribute4 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('The organisation of the programme to be carried ' + attribute4.verbose_name = ('The organisation of the programme to be carried ' 'out.') attribute5 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('The details of the work as the outlined by the ' + attribute5.verbose_name = ('The details of the work as the outlined by the ' 'principal investigator(PI).') attribute6 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('Sufficiency of funds as requested by the PI.') + attribute6.verbose_name = ('Sufficiency of funds as requested by the PI.') attribute7 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('Social impact/reach/spread of the outcome of the ' + attribute7.verbose_name = ('Social impact/reach/spread of the outcome of the ' 'proposal.') attribute8 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('Contribution of the proposal to minimizing the ' + attribute8.verbose_name = ('Contribution of the proposal to minimizing the ' 'digital divide in our country.') attribute9 = models.PositiveSmallIntegerField( choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) - attribute1.verbose_name = ('Any other matter which is likely to affect the ' + attribute9.verbose_name = ('Any other matter which is likely to affect the ' 'execution of the project(max 600 characters).') diff -r e78a5483553e -r 3cb38edbe05f app/projrev/views/helpers/forms.py --- a/app/projrev/views/helpers/forms.py Mon Aug 10 17:18:07 2009 +0530 +++ b/app/projrev/views/helpers/forms.py Mon Aug 10 19:38:53 2009 +0530 @@ -27,8 +27,8 @@ # fields in the Project that must not appear in the form, but have # be automatically generated. - fields = ('line_item', 'institution', 'state', - 'district', 'mobile_num', 'fax_num') + fields = ('title', 'line_item', 'institution', 'address', 'city', + 'pin_code', 'state', 'district', 'mobile_num', 'fax_num') class ReviewForm(forms.ModelForm): diff -r e78a5483553e -r 3cb38edbe05f app/projrev/views/proposal.py --- a/app/projrev/views/proposal.py Mon Aug 10 17:18:07 2009 +0530 +++ b/app/projrev/views/proposal.py Mon Aug 10 19:38:53 2009 +0530 @@ -167,16 +167,18 @@ prop_form = projrev_forms.ProposalForm( initial=initial_vals, instance=project) - proposal = project.proposal_set.all().order_by('-submitted_on')[0] - - if proposal: - proposal_path = str(proposal.document) + proposals = project.proposal_set.all() + if proposals: + proposal = proposals.order_by('-submitted_on')[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 if 'HTTP_REFERER' in request.META: referer = request.META['HTTP_REFERER'].split('/') @@ -400,6 +402,33 @@ return HttpResponse(None) +def getNewDistrictsForState(request): + """Get initial district for state. + """ + + get_params = request.GET + if get_params: + st_code = get_params['_value'] + dt_dict = Project.DISTRICT_CHOICES + + # Get the Districts corresponding to the given State code. + dt_names = {} + count = 1 + for dt_code in dt_dict: + if dt_code[:2] == st_code: + dt_names[dt_code] = dt_dict[dt_code] + count += 1 + + # Sort the List based on District Name. + dt_send = [{'': "---------"}] + dt_names_sorted = sorted(dt_names.items(), key=lambda (k,v): (v,k)) + for dt_code, dt_name in dt_names_sorted: + dt_send.append({dt_code: dt_name}) + + return HttpResponse(json.dumps(dt_send)) + + return HttpResponse(None) + @access.register('reviewer') @access.checkAccess def listMyReviews(request): diff -r e78a5483553e -r 3cb38edbe05f app/templates/projrev/proposal/review.html --- a/app/templates/projrev/proposal/review.html Mon Aug 10 17:18:07 2009 +0530 +++ b/app/templates/projrev/proposal/review.html Mon Aug 10 19:38:53 2009 +0530 @@ -21,6 +21,13 @@
+ Title: +
+
+ {{ project.title }} +
+
+
Project MICR Code:
@@ -42,6 +49,27 @@

+ Address: +
+
+ {{ project.address }} +
+
+
+ City: +
+
+ {{ project.city }} +
+
+
+ PIN Code: +
+
+ {{ project.pin_code }} +
+
+
State:
diff -r e78a5483553e -r 3cb38edbe05f app/templates/projrev/proposal/submit.html --- a/app/templates/projrev/proposal/submit.html Mon Aug 10 17:18:07 2009 +0530 +++ b/app/templates/projrev/proposal/submit.html Mon Aug 10 19:38:53 2009 +0530 @@ -8,8 +8,23 @@ $('#id_state').chainSelect('#id_district','/proposal/submit/get_dfors'); }); $(document).ready(function() { - $.get('/proposal/submit/get_dfors', function() { - $('#id_district').html(''); + dt_val = $('#id_district').val(); + $.getJSON('/proposal/submit/get_new_dfors', + { '_value': $('#id_state').val() }, + function(data) { + var option_html = ""; + for (i in data) { + if (data[i]) { + for (key in data[i]) { + if (key == dt_val) { + option_html += ''; + } else { + option_html += ''; + } + } + } + } + $('#id_district').html(option_html); }); }); diff -r e78a5483553e -r 3cb38edbe05f app/urls.py --- a/app/urls.py Mon Aug 10 17:18:07 2009 +0530 +++ b/app/urls.py Mon Aug 10 19:38:53 2009 +0530 @@ -24,6 +24,8 @@ (r'^proposal/submit/$', 'app.projrev.views.proposal.getMicr'), (r'^proposal/submit/get_dfors$', 'app.projrev.views.proposal.getDistrictsForState'), + (r'^proposal/submit/get_new_dfors$', + 'app.projrev.views.proposal.getNewDistrictsForState'), (r'^proposal/submit/create/$', 'app.projrev.views.proposal.submit'), # disabled for now. # (r'^proposal/withdraw/(?P[A-Z]{6}\d{9})/$',