0
|
1 |
"""This module contains the form helpers
|
|
2 |
"""
|
|
3 |
|
|
4 |
|
|
5 |
__authors__ = [
|
|
6 |
'"Madhusudan.C.S" <madhusudancs@gmail.com>',
|
|
7 |
]
|
|
8 |
|
|
9 |
from django import forms
|
|
10 |
|
|
11 |
from projrev.models import Project
|
|
12 |
from projrev.models import Review
|
|
13 |
|
|
14 |
class ProposalForm(forms.ModelForm):
|
|
15 |
"""Creates a form for the project.
|
|
16 |
"""
|
|
17 |
|
|
18 |
document = forms.FileField()
|
|
19 |
micr_code = forms.CharField(max_length=15, required=False)
|
|
20 |
|
|
21 |
class Meta:
|
|
22 |
# We store most of the data in Project model. So even though the
|
|
23 |
# name and the purpose of the form is for Proposal acceptance, we
|
|
24 |
# use Project model here.
|
|
25 |
model = Project
|
|
26 |
|
|
27 |
# fields in the Project that must not appear in the form, but have
|
|
28 |
# be automatically generated.
|
|
29 |
fields = ('micr_code', 'line_item', 'institution', 'state', 'district')
|
|
30 |
|
|
31 |
class ReviewForm(forms.ModelForm):
|
|
32 |
"""Creates a form for review of proposal.
|
|
33 |
"""
|
|
34 |
|
|
35 |
project = forms.ModelChoiceField(queryset=Project.objects.all(),
|
|
36 |
widget=forms.HiddenInput(),
|
|
37 |
required=False)
|
|
38 |
|
|
39 |
class Meta:
|
|
40 |
# Create a form from Review data model.
|
|
41 |
model = Review
|
|
42 |
|
1
|
43 |
exclude = ('reviewer')
|