Beispiel #1
0
from django.urls import path

from core.cache import cache_per_user
from annuaire import views

ANNUAIRE_CACHE_TTL = 60 * 60


urlpatterns = [
    path("", cache_per_user(ANNUAIRE_CACHE_TTL)(views.home), name="annuaire_home"),
    path(
        "<str:departement>/",
        cache_per_user(ANNUAIRE_CACHE_TTL)(views.departement),
        name="annuaire_departement",
    ),
]
Beispiel #2
0
from django.urls import path

from core.cache import cache_per_user
from . import views

STATS_CACHE_TTL = 60 * 5

urlpatterns = [
    path(
        "",
        cache_per_user(STATS_CACHE_TTL)(views.stats),
        name="stats_home",
    ),
    path(
        "territoires/",
        cache_per_user(STATS_CACHE_TTL)(views.territoires),
        name="stats_territoires",
    ),
]
Beispiel #3
0
def cache_user_page(view):
    return cache_per_user(APP_CACHE_TTL)(view)
Beispiel #4
0
def cache_editorial_page(template_name, context=None):
    return cache_per_user(EDITORIAL_CACHE_TTL)(views.EditorialView.as_view(
        template_name=template_name, extra_context=context))
Beispiel #5
0
def cache_app_page():
    return cache_per_user(APP_CACHE_TTL)(views.App.as_view())