| | 22 | from django.core.cache import cache |
| | 23 | |
| | 24 | def delete_page_cache(): |
| | 25 | """ |
| | 26 | Delete all pages in the cache. |
| | 27 | Needed, if: |
| | 28 | - A template has been edited |
| | 29 | - The menu changes (edit the page name, position, parent link) |
| | 30 | TODO: move this function from models.py into a other nice place... |
| | 31 | """ |
| | 32 | from PyLucid.models import Page |
| | 33 | for items in Page.objects.values('shortcut').iterator(): |
| | 34 | shortcut = items["shortcut"] |
| | 35 | cache_key = settings.PAGE_CACHE_PREFIX + shortcut |
| | 36 | cache.delete(cache_key) |