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