equal
deleted
inserted
replaced
25 from soc.logic.models import program |
25 from soc.logic.models import program |
26 from soc.logic.models import sponsor as sponsor_logic |
26 from soc.logic.models import sponsor as sponsor_logic |
27 |
27 |
28 import soc.models.program |
28 import soc.models.program |
29 |
29 |
30 import soc.modules.ghop.logic.models.timeline |
|
31 import soc.modules.ghop.models.program |
30 import soc.modules.ghop.models.program |
32 |
31 |
33 |
32 |
34 class Logic(program.Logic): |
33 class Logic(program.Logic): |
35 """Logic methods for the GHOPProgram model. |
34 """Logic methods for the GHOPProgram model. |
42 """ |
41 """ |
43 |
42 |
44 super(Logic, self).__init__(model, base_model=base_model, |
43 super(Logic, self).__init__(model, base_model=base_model, |
45 scope_logic=scope_logic) |
44 scope_logic=scope_logic) |
46 |
45 |
47 self.timeline_logic = soc.modules.ghop.logic.models.timeline.logic |
|
48 |
|
49 def createTimelineForType(self, fields): |
|
50 """Creates and stores a timeline model for the given type of program. |
|
51 """ |
|
52 |
|
53 properties = self.timeline_logic.getKeyFieldsFromFields(fields) |
|
54 key_name = self.timeline_logic.getKeyNameFromFields(properties) |
|
55 |
|
56 properties['scope'] = fields['scope'] |
|
57 |
|
58 timeline = self.timeline_logic.updateOrCreateFromKeyName(properties, |
|
59 key_name) |
|
60 return timeline |
|
61 |
|
62 |
46 |
63 logic = Logic() |
47 logic = Logic() |