try: tcp = settings.TEMPLATE_CONTEXT_PROCESSORS except AttributeError: tcp = [] if ("django.core.context_processors.request" not in tcp) \ and ("django.template.context_processors.request" not in tcp): raise RuntimeError( "django.template.context_processors.request is required" ) import ultracache.monkey try: purger = importer(settings.ULTRACACHE["purge"]["method"]) except (AttributeError, KeyError): purger = None try: invalidate = settings.ULTRACACHE["invalidate"] except (AttributeError, KeyError): invalidate = True @receiver(post_save) def on_post_save(sender, **kwargs): """Expire ultracache cache keys affected by this object """ if not invalidate:
from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.cache import cache from django.db.migrations.recorder import MigrationRecorder from django.db.models import Model from django.db.models.signals import post_save, post_delete from django.dispatch import receiver try: from django.utils.module_loading import import_string as importer except ImportError: from django.utils.module_loading import import_by_path as importer try: purger = importer(settings.ULTRACACHE["purge"]["method"]) except (AttributeError, KeyError): purger = None try: invalidate = settings.ULTRACACHE["invalidate"] except (AttributeError, KeyError): invalidate = True @receiver(post_save) def on_post_save(sender, **kwargs): """Expire ultracache cache keys affected by this object """ if not invalidate: return
from django.template.loader import get_template_from_string from django.template import Context try: from django.utils.module_loading import import_string as importer except ImportError: from django.utils.module_loading import import_by_path as importer from django.conf import settings from preferences.models import Preferences from ckeditor.fields import RichTextField from south.modelsinspector import add_introspection_rules from foundry.models import Menu, Navbar, Page try: generator = importer(settings.JMBO_SITEMAP['generator']) except (AttributeError, KeyError): generator = None DRAFT_TEMPLATE = ''' {% load i18n %} <html> <body> {% if navbars %} {% trans "Navbars" %}: <ul> {% for navbar in navbars %} <li>{{ navbar.title }}</li> <li>