app/soc/logic/models/document.py
changeset 1019 0cd056f2c739
parent 678 b982d9175605
child 1095 0122dc66e5d2
--- a/app/soc/logic/models/document.py	Wed Jan 28 00:33:47 2009 +0000
+++ b/app/soc/logic/models/document.py	Wed Jan 28 00:35:11 2009 +0000
@@ -22,6 +22,7 @@
   ]
 
 
+from soc.cache import sidebar
 from soc.logic.models import work
 from soc.logic.models import linkable as linkable_logic
 
@@ -41,5 +42,21 @@
     super(Logic, self).__init__(model=model, base_model=base_model,
                                 scope_logic=scope_logic)
 
+  def _updateField(self, entity, name, value):
+    """Special logic for role. If state changes to active we flush the sidebar.
+    """
+
+    if (name == 'is_featured') and (entity.is_featured != value):
+      sidebar.flush()
+
+    return True
+
+  def _onCreate(self, entity):
+    """Flush the sidebar cache when a new active role entity has been created.
+    """
+
+    if entity.is_featured:
+      sidebar.flush()
+
 
 logic = Logic()