Changed data models to all new data.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Sun, 09 Aug 2009 13:04:03 +0530
changeset 21 153db75bb515
parent 20 327b3f0b73bb
child 22 0321f984fb16
Changed data models to all new data.
app/projrev/models.py
app/projrev/views/proposal.py
app/site-content/css/projrev.css
--- a/app/projrev/models.py	Sun Aug 09 12:40:14 2009 +0530
+++ b/app/projrev/models.py	Sun Aug 09 13:04:03 2009 +0530
@@ -704,16 +704,15 @@
     """Get the State name from its code.
     """
 
-    line_item_dict = dict(cls.LINE_ITEM_CHOICES)
-    return line_item_dict[code]
+    return cls.LINE_ITEM_CHOICES[code]
 
   @classmethod
   def getLineItemCode(cls, name):
     """Get the Line Item code from its name.
     """
 
-    for ln_code, ln_name in cls.LINE_ITEM_CHOICES:
-      if ln_name == name:
+    for ln_code in cls.LINE_ITEM_CHOICES:
+      if cls.LINE_ITEM_CHOICES[ln_code] == name:
         return ln_code
 
     return None
@@ -723,16 +722,15 @@
     """Get the State code from its name.
     """
 
-    state_dict = dict(cls.STATE_CHOICES)
-    return state_dict[code]
+    return cls.STATE_CHOICES[code]
 
   @classmethod
   def getStateCode(cls, name):
     """Get the State code from its name.
     """
 
-    for st_code, st_name in cls.STATE_CHOICES:
-      if st_name == name:
+    for st_code in cls.STATE_CHOICES:
+      if cls.STATE_CHOICES[st_code] == name:
         return st_code
 
     return None
@@ -742,16 +740,15 @@
     """Get the District name from its code.
     """
 
-    district_dict = dict(cls.DISTRICT_CHOICES)
-    return district_dict[code]
+    return cls.DISTRICT_CHOICES[code]
 
   @classmethod
   def getDistrictCode(cls, name):
     """Get the District code from its name.
     """
 
-    for dt_code, dt_name in cls.DISTRICT_CHOICES:
-      if dt_name == name:
+    for dt_code in cls.DISTRICT_CHOICES:
+      if cls.DISTRICT_CHOICES[dt_code] == name:
         return dt_code
 
     return None
--- a/app/projrev/views/proposal.py	Sun Aug 09 12:40:14 2009 +0530
+++ b/app/projrev/views/proposal.py	Sun Aug 09 13:04:03 2009 +0530
@@ -94,9 +94,8 @@
       project.district = Project.getDistrict(cleaned_data['district'])
     else:
       # Generate MICR code
-      cleaned_data['micr_code'] = '%s%s%s%d' % (
-          cleaned_data['state'], cleaned_data['district'],
-          cleaned_data['line_item'], 
+      cleaned_data['micr_code'] = '%s%s%d' % (
+          cleaned_data['district'], cleaned_data['line_item'], 
           int(time.time() * 1000) % 1000000000)
 
       cleaned_data['line_item'] = Project.getLineItem(cleaned_data['line_item'])
--- a/app/site-content/css/projrev.css	Sun Aug 09 12:40:14 2009 +0530
+++ b/app/site-content/css/projrev.css	Sun Aug 09 13:04:03 2009 +0530
@@ -145,7 +145,8 @@
 }
 select {
 	margin-left: 3%;
-	width: auto;
+	width: 313px;
+	overflow: scroll;
 }
 textarea {
 	width:40%;