Le cache des pages ne contient pas le formulaire
This commit is contained in:
parent
1f60bf0c39
commit
df27949036
@ -8,6 +8,8 @@ from django.urls import reverse
|
|||||||
from colorfield.fields import ColorField
|
from colorfield.fields import ColorField
|
||||||
from django_ckeditor_5.fields import CKEditor5Field
|
from django_ckeditor_5.fields import CKEditor5Field
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
from django.core.cache import cache
|
||||||
|
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import os
|
import os
|
||||||
from django.core.files import File
|
from django.core.files import File
|
||||||
@ -213,6 +215,10 @@ class Tag(models.Model):
|
|||||||
return reverse("view_tag", kwargs={"t": self.name})
|
return reverse("view_tag", kwargs={"t": self.name})
|
||||||
|
|
||||||
def get_tag_groups(nb_suggestions=10, exclude=False, include=False):
|
def get_tag_groups(nb_suggestions=10, exclude=False, include=False):
|
||||||
|
id_cache = 'all_tags ' + str(exclude) + ' ' + str(include) + ' ' + str(nb_suggestions)
|
||||||
|
result = cache.get(id_cache)
|
||||||
|
if not result: #
|
||||||
|
|
||||||
free_tags = Event.get_all_tags(False)
|
free_tags = Event.get_all_tags(False)
|
||||||
|
|
||||||
obj_tags = Tag.objects
|
obj_tags = Tag.objects
|
||||||
@ -245,6 +251,7 @@ class Tag(models.Model):
|
|||||||
result = ((_('Suggestions'), [(t["tag"], t["tag"]) for t in tags1]),
|
result = ((_('Suggestions'), [(t["tag"], t["tag"]) for t in tags1]),
|
||||||
(_('Others'), [(t["tag"], t["tag"]) for t in tags2]))
|
(_('Others'), [(t["tag"], t["tag"]) for t in tags2]))
|
||||||
|
|
||||||
|
cache.set(id_cache, result, 300) # 5mn
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% get_current_language as LANGUAGE_CODE %}
|
|
||||||
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
|
||||||
{% cache cache_timeout month user.is_authenticated calendar.firstdate filter.to_str LANGUAGE_CODE %}
|
|
||||||
|
|
||||||
{% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=0 %}
|
{% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=0 %}
|
||||||
|
|
||||||
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
|
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
||||||
|
{% cache cache_timeout month user.is_authenticated calendar.firstdate filter.to_str LANGUAGE_CODE %}
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
|
@ -21,9 +21,6 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% get_current_language as LANGUAGE_CODE %}
|
|
||||||
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
|
||||||
{% cache cache_timeout upcoming user.is_authenticated calendar.firstdate filter.to_str calendar.calendar_days_list|length LANGUAGE_CODE %}
|
|
||||||
|
|
||||||
<article id="filters">
|
<article id="filters">
|
||||||
<header><h1 id="index-avenir">{% block title %}{% block og_title %}
|
<header><h1 id="index-avenir">{% block title %}{% block og_title %}
|
||||||
@ -40,6 +37,10 @@
|
|||||||
|
|
||||||
{% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=1 %}
|
{% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=1 %}
|
||||||
|
|
||||||
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
|
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
||||||
|
{% cache cache_timeout upcoming user.is_authenticated calendar.firstdate filter.to_str calendar.calendar_days_list|length LANGUAGE_CODE %}
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<a href="{% if calendar.calendar_days_list|length == 1 %}{% url 'day_view' date_pred.year date_pred.month date_pred.day %}{% else %}{% url 'a_venir_jour' date_pred.year date_pred.month date_pred.day %}{% endif %}" aria-label="dates précédentes" role="button">
|
<a href="{% if calendar.calendar_days_list|length == 1 %}{% url 'day_view' date_pred.year date_pred.month date_pred.day %}{% else %}{% url 'a_venir_jour' date_pred.year date_pred.month date_pred.day %}{% endif %}" aria-label="dates précédentes" role="button">
|
||||||
{% picto_from_name "chevrons-left" %}
|
{% picto_from_name "chevrons-left" %}
|
||||||
|
@ -21,12 +21,13 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
{% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=0 %}
|
||||||
|
|
||||||
|
|
||||||
{% get_current_language as LANGUAGE_CODE %}
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
||||||
{% cache cache_timeout week user.is_authenticated calendar.firstdate filter.to_str LANGUAGE_CODE %}
|
{% cache cache_timeout week user.is_authenticated calendar.firstdate filter.to_str LANGUAGE_CODE %}
|
||||||
|
|
||||||
{% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=0 %}
|
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<div class="title small"><h1>
|
<div class="title small"><h1>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user