app/projrev/views/helpers/forms.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Sun, 09 Aug 2009 12:39:51 +0530
changeset 19 0c9bdcfac9f7
parent 13 684540719344
child 24 7257b66a6766
permissions -rw-r--r--
Added all data
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
"""This module contains the form helpers
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
"""
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
__authors__ = [
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
]
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
6
17cab73c49eb Request context.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 4
diff changeset
     9
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
from django import forms
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
from projrev.models import Project
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
from projrev.models import Review
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    15
class ProposalForm(forms.ModelForm):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
  """Creates a form for the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    17
  """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    18
13
684540719344 Added footer line.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 6
diff changeset
    19
  document = forms.FileField(required=False)
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    21
  class Meta:
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
    # We store most of the data in Project model. So even though the
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    23
    # name and the purpose of the form is for Proposal acceptance, we
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    24
    # use Project model here.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    25
    model = Project
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    26
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    27
    # fields in the Project that must not appear in the form, but have
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    28
    # be automatically generated.
19
0c9bdcfac9f7 Added all data
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 13
diff changeset
    29
    fields = ('line_item', 'institution', 'state', 
0c9bdcfac9f7 Added all data
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 13
diff changeset
    30
              'district', 'mobile_num', 'fax_num')
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    31
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    32
class ReviewForm(forms.ModelForm):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    33
  """Creates a form for review of proposal.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    34
  """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    35
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
  project = forms.ModelChoiceField(queryset=Project.objects.all(), 
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
                                   widget=forms.HiddenInput(),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    38
                                   required=False)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    40
  class Meta:
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    41
    # Create a form from Review data model.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    42
    model = Review
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    43
1
324233b04d76 Login mechanism.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    44
    exclude = ('reviewer')