diff --git a/PyRIGS/settings.py b/PyRIGS/settings.py index e8d46fed..cb5eac81 100644 --- a/PyRIGS/settings.py +++ b/PyRIGS/settings.py @@ -152,17 +152,19 @@ LOGGING = { } } -# Caching -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', - 'LOCATION': 'cache_table', - } -} # Tests lock up SQLite otherwise if DEBUG or STAGING or CI: - CACHES['default'] = { - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' + CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' + } + } +else: + CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', + 'LOCATION': 'cache_table', + } } RAVEN_CONFIG = { diff --git a/PyRIGS/tests/base.py b/PyRIGS/tests/base.py index b6b5678d..d8af4237 100644 --- a/PyRIGS/tests/base.py +++ b/PyRIGS/tests/base.py @@ -89,10 +89,7 @@ def screenshot_failure_cls(cls): # Checks if animation is done -class animation_is_finished(object): - def __init__(self): - pass - +class animation_is_finished(): def __call__(self, driver): numberAnimating = driver.execute_script('return $(":animated").length') finished = numberAnimating == 0 diff --git a/PyRIGS/views.py b/PyRIGS/views.py index 855a6c85..a70e36da 100644 --- a/PyRIGS/views.py +++ b/PyRIGS/views.py @@ -20,12 +20,11 @@ from RIGS import models, forms from assets import models as asset_models from functools import reduce -from django.views.decorators.cache import never_cache +from django.views.decorators.cache import never_cache, cache_page from django.utils.decorators import method_decorator # Displays the current rig count along with a few other bits and pieces -@method_decorator(never_cache, name='dispatch') # Disable browser based caching class Index(generic.TemplateView): template_name = 'index.html' diff --git a/RIGS/signals.py b/RIGS/signals.py index 5819fba7..b75dc348 100644 --- a/RIGS/signals.py +++ b/RIGS/signals.py @@ -141,8 +141,6 @@ def send_admin_awaiting_approval_email(user, request, **kwargs): user_activated.connect(send_admin_awaiting_approval_email) -# TODO Move - def update_cache(sender, instance, created, **kwargs): cache.clear() diff --git a/RIGS/templates/partials/event_table.html b/RIGS/templates/partials/event_table.html index 7b15b794..db75554c 100644 --- a/RIGS/templates/partials/event_table.html +++ b/RIGS/templates/partials/event_table.html @@ -1,4 +1,6 @@ {% load namewithnotes from filters %} +{% load cache %} +{% cache None event_table request.user %}