app/projrev/models.py
author Santosh G. Vattam <vattam.santosh@gmail.com>
Thu, 06 Aug 2009 18:49:06 +0530
changeset 33 2840389ee7f9
parent 4 8d9da911ed7d
child 16 bed14c9685a5
permissions -rw-r--r--
Added checkAccess routine
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 data model for the project funded by NME
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
through ICT.
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
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
__authors__ = [
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
]
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
from django.db import models
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
from django.contrib.auth.models import User
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
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 Project(models.Model):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
  """Model class for NME funded projects.
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
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
  LINE_ITEM_CHOICES = [('ME', 'Mechanical'), 
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
                       ('CE', 'Chemical'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    21
                       ('EE', 'Electrical'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
                       ('AE', 'Aero Space'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    23
                       ('CS', 'Computer Science'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    24
                       ('IT', 'Information Technology'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    25
                      ]
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
  STATE_CHOICES = [('MH', 'Maharashtra'), 
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    28
                   ('KA', 'Karnataka'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    29
                   ('KL', 'Kerala'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    30
                   ('TN', 'Tamil Nadu'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    31
                   ('AP', 'Andra Pradesh'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    32
                  ]
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    33
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    34
  DISTRICT_CHOICES = [('AD', 'Adilabad'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    35
                      ('RT', 'Ratnagiri'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
                      ('MU', 'Mumbai suburban'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
                      ('PU', 'Pune'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    38
                      ('PL', 'Palakkad'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
                      ('BN', 'Bangalore Urban district'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    40
                      ('CK', 'Chikmagalur District'),
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    41
                     ]
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    42
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    43
  # Field containing the Line Item to which the project belongs to.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    44
  line_item = models.CharField(max_length=256,
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    45
                               choices=LINE_ITEM_CHOICES)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    46
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    47
  # Field containing the name of the institution working on the
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    48
  # project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    49
  institution = models.CharField(max_length=256)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    50
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    51
  # Field containing the state to which the institution belongs to.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    52
  state = models.CharField(max_length=256,
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    53
                           choices=STATE_CHOICES)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    54
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    55
  # Field containing the district to which the institution belongs
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    56
  # to in the state of India.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    57
  district = models.CharField(max_length=256,
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    58
                              choices=DISTRICT_CHOICES)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    59
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    60
  # Field containing the autogenerated MICR code for the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    61
  micr_code = models.CharField(max_length=15, unique=True)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    62
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    63
  # Field containing the status of the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    64
  # status of the project can be one among the following
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    65
  # New, Revised, Funded, Pilot, DPE
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    66
  status = models.CharField(max_length=256,
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    67
                            choices=[('new', 'New'), ('pilot', 'Pilot'),
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    68
                                     ('invalid', 'Invalid')])
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    69
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    70
  @classmethod
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    71
  def getLineItem(cls, code):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    72
    """Get the State name from its code.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    73
    """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    74
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    75
    line_item_dict = dict(cls.LINE_ITEM_CHOICES)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    76
    return line_item_dict[code]
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    77
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    78
  @classmethod
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    79
  def getLineItemCode(cls, name):
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    80
    """Get the Line Item code from its name.
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    81
    """
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    82
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    83
    for ln_code, ln_name in cls.LINE_ITEM_CHOICES:
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    84
      if ln_name == name:
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    85
        return ln_code
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    86
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    87
    return None
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    88
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    89
  @classmethod
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    90
  def getState(cls, code):
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    91
    """Get the State code from its name.
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    92
    """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    93
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    94
    state_dict = dict(cls.STATE_CHOICES)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    95
    return state_dict[code]
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    96
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    97
  @classmethod
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    98
  def getStateCode(cls, name):
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
    99
    """Get the State code from its name.
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   100
    """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   101
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   102
    for st_code, st_name in cls.STATE_CHOICES:
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   103
      if st_name == name:
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   104
        return st_code
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   105
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   106
    return None
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   107
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   108
  @classmethod
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   109
  def getDistrict(cls, code):
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   110
    """Get the District name from its code.
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   111
    """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   112
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   113
    district_dict = dict(cls.DISTRICT_CHOICES)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   114
    return district_dict[code]
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   115
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   116
  @classmethod
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   117
  def getDistrictCode(cls, name):
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   118
    """Get the District code from its name.
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   119
    """
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   120
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   121
    for dt_code, dt_name in cls.DISTRICT_CHOICES:
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   122
      if dt_name == name:
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   123
        return dt_code
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   124
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   125
    return None
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 0
diff changeset
   126
0
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   127
class Proposal(models.Model):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   128
  """Model class for the project's proposal.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   129
  """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   130
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   131
  #: Field representing the relation to the corresponding project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   132
  project = models.ForeignKey(Project)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   133
 
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   134
  #: Field containing the Line Item to which the project belongs to.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   135
  document = models.FileField(upload_to='proposals/%Y/%m/%d')
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   136
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   137
  #: Field containing the date on which the document was submitted
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   138
  submitted_on = models.DateTimeField(auto_now_add=True)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   139
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   140
  #: Field containing the reference to the user who submitted the proposal.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   141
  submitted_by = models.ForeignKey(User, null=True)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   142
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   143
  #: Field containing the revision number of the proposal belonging to
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   144
  #: the Project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   145
  rev_num = models.PositiveIntegerField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   146
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   147
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   148
class Timeline(models.Model):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   149
  """Model class for the project's timeline.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   150
  """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   151
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   152
  #: Field representing the relation to the corresponding project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   153
  project = models.ForeignKey(Project)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   154
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   155
  #: Field containing the date and time of submission of proposal.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   156
  submitted = models.DateTimeField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   157
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   158
  #: Field containing the last date and time of review of proposal.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   159
  reviewed = models.DateTimeField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   160
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   161
  #: Field containing the date and time of amount paid for the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   162
  amount_paid = models.DateTimeField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   163
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   164
  #: Field containing the date and time of presentation of the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   165
  presentation = models.DateTimeField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   166
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   167
  #: Field containing the date and time of monitoring of the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   168
  monitoring = models.DateTimeField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   169
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   170
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   171
class Fund(models.Model):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   172
  """Model class for the project's funds.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   173
  """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   174
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   175
  #: Field representing the relation to the corresponding project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   176
  project = models.ForeignKey(Project)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   177
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   178
  #: Field containing the amount sanctioned as funds for the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   179
  sanctioned = models.FloatField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   180
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   181
  #: Field containing the expenses for the sanctioned fund for
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   182
  #: the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   183
  expenses = models.FloatField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   184
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   185
  #: Field containing the date and time on which the funds were
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   186
  #: sanctioned for the project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   187
  sanctioned_on = models.DateTimeField(auto_now_add=True)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   188
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   189
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   190
class Review(models.Model):
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   191
  """Model class for the project's proposal's review.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   192
  """
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   193
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   194
  #: Field representing the relation to the corresponding project.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   195
  project = models.ForeignKey(Project)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   196
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   197
  #: Field containing the comment entered along with the review.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   198
  comment = models.TextField()
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   199
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   200
  #: Field representing the reference to the person who
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   201
  #: did the review.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   202
  reviewer = models.ForeignKey(User, null=True)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   203
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   204
  #: Field containing the date and time of review of the proposal.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   205
  reviewed_on = models.DateTimeField(auto_now_add=True)
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   206
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   207
  #: Field containing the review value for this attribute.
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   208
  attribute1 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   209
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   210
  
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   211
  attribute2 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   212
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   213
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   214
  attribute3 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   215
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   216
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   217
  attribute4 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   218
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   219
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   220
  attribute5 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   221
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   222
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   223
  attribute6 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   224
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   225
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   226
  attribute7 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   227
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   228
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   229
  attribute8 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   230
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   231
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   232
  attribute9 = models.PositiveSmallIntegerField(
c94bd9ae70d2 First commit.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   233
      choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])