author | Madhusudan.C.S <madhusudancs@gmail.com> |
Mon, 10 Aug 2009 19:38:53 +0530 | |
changeset 38 | 3cb38edbe05f |
parent 30 | 94fe7fe7394d |
child 39 | e7880a8f7e04 |
permissions | -rw-r--r-- |
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 |
26
97bd3c28c957
Renamed Comments to Reviews.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
24
diff
changeset
|
11 |
from django.contrib.auth.models import User |
0 | 12 |
|
13 |
from projrev.models import Project |
|
14 |
from projrev.models import Review |
|
15 |
||
16 |
class ProposalForm(forms.ModelForm): |
|
17 |
"""Creates a form for the project. |
|
18 |
""" |
|
19 |
||
24
7257b66a6766
Purr implemented for submit form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
19
diff
changeset
|
20 |
document = forms.FileField(required=False, help_text='Select the document path from your local file system.') |
0 | 21 |
|
22 |
class Meta: |
|
23 |
# We store most of the data in Project model. So even though the |
|
24 |
# name and the purpose of the form is for Proposal acceptance, we |
|
25 |
# use Project model here. |
|
26 |
model = Project |
|
27 |
||
28 |
# fields in the Project that must not appear in the form, but have |
|
29 |
# be automatically generated. |
|
38 | 30 |
fields = ('title', 'line_item', 'institution', 'address', 'city', |
31 |
'pin_code', 'state', 'district', 'mobile_num', 'fax_num') |
|
0 | 32 |
|
30
94fe7fe7394d
Complete star plugin implmentation on backend with database writes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
26
diff
changeset
|
33 |
|
0 | 34 |
class ReviewForm(forms.ModelForm): |
35 |
"""Creates a form for review of proposal. |
|
36 |
""" |
|
37 |
||
38 |
project = forms.ModelChoiceField(queryset=Project.objects.all(), |
|
39 |
widget=forms.HiddenInput(), |
|
40 |
required=False) |
|
26
97bd3c28c957
Renamed Comments to Reviews.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
24
diff
changeset
|
41 |
reviewer = forms.ModelChoiceField(queryset=User.objects.all(), |
97bd3c28c957
Renamed Comments to Reviews.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
24
diff
changeset
|
42 |
widget=forms.HiddenInput(), |
97bd3c28c957
Renamed Comments to Reviews.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
24
diff
changeset
|
43 |
required=False) |
0 | 44 |
|
45 |
class Meta: |
|
46 |
# Create a form from Review data model. |
|
47 |
model = Review |