Fixed a bug where a new timeline would get created on every edit of an existing program.
authorLennard de Rijk <ljvderijk@gmail.com>
Tue, 06 Jan 2009 21:21:09 +0000
changeset 770 eb2e69312953
parent 769 a0ee643fe832
child 771 0b1beae179f5
Fixed a bug where a new timeline would get created on every edit of an existing program. Patch by: Lennard de Rijk
app/soc/views/models/program.py
--- a/app/soc/views/models/program.py	Tue Jan 06 20:56:48 2009 +0000
+++ b/app/soc/views/models/program.py	Tue Jan 06 21:21:09 2009 +0000
@@ -89,7 +89,12 @@
     """See base._editPost().
     """
     
-    fields['timeline'] = self._createTimelineForType(fields['workflow'])
+    if not entity:
+      # there is no existing entity so create a new timeline
+      fields['timeline'] = self._createTimelineForType(fields['workflow'])
+    else:
+      # use the timeline from the entity
+      fields['timeline'] = entity.timeline
     
   def _createTimelineForType(self, type):
     """Creates and stores a timeline model for the given type of program