equal
deleted
inserted
replaced
20 __authors__ = [ |
20 __authors__ = [ |
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>', |
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>', |
22 ] |
22 ] |
23 |
23 |
24 |
24 |
|
25 from soc.cache import sidebar |
25 from soc.logic.models import work |
26 from soc.logic.models import work |
26 from soc.logic.models import linkable as linkable_logic |
27 from soc.logic.models import linkable as linkable_logic |
27 |
28 |
28 import soc.models.document |
29 import soc.models.document |
29 import soc.models.work |
30 import soc.models.work |
39 """ |
40 """ |
40 |
41 |
41 super(Logic, self).__init__(model=model, base_model=base_model, |
42 super(Logic, self).__init__(model=model, base_model=base_model, |
42 scope_logic=scope_logic) |
43 scope_logic=scope_logic) |
43 |
44 |
|
45 def _updateField(self, entity, name, value): |
|
46 """Special logic for role. If state changes to active we flush the sidebar. |
|
47 """ |
|
48 |
|
49 if (name == 'is_featured') and (entity.is_featured != value): |
|
50 sidebar.flush() |
|
51 |
|
52 return True |
|
53 |
|
54 def _onCreate(self, entity): |
|
55 """Flush the sidebar cache when a new active role entity has been created. |
|
56 """ |
|
57 |
|
58 if entity.is_featured: |
|
59 sidebar.flush() |
|
60 |
44 |
61 |
45 logic = Logic() |
62 logic = Logic() |