parent
63d3cb76ea
commit
430c7b47a2
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
{% extends "agenda_culturel/page-admin.html" %}
|
||||
|
||||
|
||||
{% block fluid %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<article>
|
||||
<header>
|
||||
<h1>{% block title %}{% block og_title %}Vider le cache{% endblock %}{% endblock %}</h1>
|
||||
</header>
|
||||
<form method="post">{% csrf_token %}
|
||||
<p>Êtes-vous sûr·e de vouloir vider le cache ? Toutes les pages seront
|
||||
générées lors de leur consultation, mais cela peut ralentir temporairemenet l'expérience de navigation.
|
||||
</p>
|
||||
{{ form }}
|
||||
|
||||
<footer>
|
||||
<div class="grid buttons">
|
||||
<a href="{{ cancel_url }}" role="button" class="secondary">Annuler</a>
|
||||
<input type="submit" value="Confirmer">
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
@ -68,6 +68,7 @@
|
||||
<h3>Configuration interne</h3>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="{% url 'clear_cache' %}">Vider le cache</a></li>
|
||||
<li><a href="{% url 'admin:index' %}">Administration de django</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -208,6 +208,8 @@ urlpatterns = [
|
||||
{"sitemaps": sitemaps},
|
||||
name="django.contrib.sitemaps.views.sitemap",
|
||||
),
|
||||
path("cache/clear", clear_cache, name="clear_cache"),
|
||||
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
@ -2227,3 +2227,15 @@ def delete_tag(request, t):
|
||||
"agenda_culturel/tag_confirm_delete_by_name.html",
|
||||
{"tag": t, "nb": nb, "nbi": nbi, "cancel_url": cancel_url, "obj": obj},
|
||||
)
|
||||
|
||||
|
||||
def clear_cache(request):
|
||||
if request.method == "POST":
|
||||
cache.clear()
|
||||
messages.success(request, _("Cache successfully cleared."))
|
||||
return HttpResponseRedirect(reverse_lazy("administration"))
|
||||
else:
|
||||
return render(
|
||||
request,
|
||||
"agenda_culturel/clear_cache.html",
|
||||
)
|
Loading…
Reference in New Issue
Block a user