0
|
1 |
"""This module contains the form helpers
|
|
2 |
"""
|
|
3 |
|
|
4 |
|
|
5 |
__authors__ = [
|
|
6 |
'"Madhusudan.C.S" <madhusudancs@gmail.com>',
|
|
7 |
]
|
|
8 |
|
6
|
9 |
|
0
|
10 |
from django import forms
|
|
11 |
|
|
12 |
from projrev.models import Project
|
|
13 |
from projrev.models import Review
|
|
14 |
|
|
15 |
class ProposalForm(forms.ModelForm):
|
|
16 |
"""Creates a form for the project.
|
|
17 |
"""
|
|
18 |
|
13
|
19 |
document = forms.FileField(required=False)
|
0
|
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.
|
19
|
29 |
fields = ('line_item', 'institution', 'state',
|
|
30 |
'district', 'mobile_num', 'fax_num')
|
0
|
31 |
|
|
32 |
class ReviewForm(forms.ModelForm):
|
|
33 |
"""Creates a form for review of proposal.
|
|
34 |
"""
|
|
35 |
|
|
36 |
project = forms.ModelChoiceField(queryset=Project.objects.all(),
|
|
37 |
widget=forms.HiddenInput(),
|
|
38 |
required=False)
|
|
39 |
|
|
40 |
class Meta:
|
|
41 |
# Create a form from Review data model.
|
|
42 |
model = Review
|
|
43 |
|
1
|
44 |
exclude = ('reviewer')
|