From 53bd48ef74f1d7bd39d75bba150223fe2866cc67 Mon Sep 17 00:00:00 2001 From: Brett Parker Date: Sun, 29 Mar 2009 21:18:25 +0100 Subject: [PATCH] Clean out menu cache --- sommitrealweird/bpcms/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sommitrealweird/bpcms/models.py b/sommitrealweird/bpcms/models.py index bf2b93b..6df6781 100644 --- a/sommitrealweird/bpcms/models.py +++ b/sommitrealweird/bpcms/models.py @@ -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()) -- 2.39.5