]> git.sommitrealweird.co.uk Git - sommitrealweird.git/commitdiff
Clean out menu cache
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Sun, 29 Mar 2009 20:18:25 +0000 (21:18 +0100)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Sun, 29 Mar 2009 20:18:25 +0000 (21:18 +0100)
sommitrealweird/bpcms/models.py

index bf2b93b019086fc551e1df331b0664a7568c86c7..6df678162223fa770634c60f74f45684139e5032 100644 (file)
@@ -1,6 +1,7 @@
 from django.db import models
 from django.conf import settings
 from django.contrib import admin
+from django.core.cache import cache
 
 FORMAT_CHOICES = (
         ('rst', 'reStructuredText'),
@@ -71,6 +72,14 @@ class Folder(models.Model):
             folderstring = "%s/" %(folderstring,)
 
         return folderstring
+    
+    def save(self, force_insert=False, force_update=False):
+        super(Folder, self).save(force_insert, force_update)
+        if self.parent == None:
+            cache.delete('bpcms_mainmenu')
+        else:
+            cache.delete('bpcms_submenu_%s' %(self.get_path()))
         
+
     def get_basic_url(self):
         return "%s%s" %(settings.BPCMS_ROOT, self.get_path())