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