app/soc/views/models/program.py
changeset 2136 5d55e61dd338
parent 2130 83f4fab7c556
child 2139 43a02512ebf7
--- a/app/soc/views/models/program.py	Wed Apr 08 22:47:46 2009 +0000
+++ b/app/soc/views/models/program.py	Wed Apr 08 23:45:41 2009 +0000
@@ -298,9 +298,9 @@
 
     if request.method == 'POST' and 'result' in request.POST:
       result = request.POST['result']
+      submit = request.GET.get('submit')
 
       from_json = simplejson.loads(result)
-
       locked_slots = dicts.groupDictBy(from_json, 'locked', 'slots')
 
     orgs = {}
@@ -312,6 +312,16 @@
       applications[org.link_id] = org.nr_applications
       max[org.link_id] = min(org.nr_mentors, org.slots_desired)
 
+      if submit:
+        org_post = from_json[org.link_id]
+        org_slots = org_post['slots']
+        try:
+          org_slots = int(org_slots)
+        except ValueError:
+          continue
+        org.slots = org_slots
+        org.put()
+
     # TODO: Use configuration variables here
     max_slots_per_org = 50
     min_slots_per_org = 2