diff --git a/borgweb/borg/templates/borg/base.html b/borgweb/borg/templates/borg/base.html index 3f0a300..5399b12 100644 --- a/borgweb/borg/templates/borg/base.html +++ b/borgweb/borg/templates/borg/base.html @@ -6,13 +6,11 @@ {% load static %} {% load cache %} - {% cache 3600 script %} {% load compress %} {% compress css %} {% endcompress %} - {% endcache %} {% block script %} {% endblock %} @@ -21,7 +19,6 @@ {% block title %}Title{% endblock %} -{% cache 3600 navbar %} -{% endcache %} {% block body %}{% endblock %} diff --git a/borgweb/borg/templates/borg/index.html b/borgweb/borg/templates/borg/index.html index 401c12d..441e7b2 100644 --- a/borgweb/borg/templates/borg/index.html +++ b/borgweb/borg/templates/borg/index.html @@ -23,7 +23,6 @@ {% endblock %} {% block body %} -{% cache 60 repos %} {% if repo_list %}
{% for repo in repo_list %} @@ -83,6 +82,5 @@ {% endif %}
-{% endcache %} {% endblock %} diff --git a/borgweb/borg/urls.py b/borgweb/borg/urls.py index f8ab28e..3461d92 100644 --- a/borgweb/borg/urls.py +++ b/borgweb/borg/urls.py @@ -4,7 +4,7 @@ from django.views.decorators.cache import cache_page from . import views urlpatterns = [ - path('', cache_page(10)(views.index), name='index'), + path('', views.index, name='index'), path('post/repo', views.post_repo, name='repo'), path('post/archive', views.post_archive, name='archive'), path('post/error', views.post_error, name='error'), diff --git a/borgweb/borg/views.py b/borgweb/borg/views.py index 8eb6067..2814433 100644 --- a/borgweb/borg/views.py +++ b/borgweb/borg/views.py @@ -7,17 +7,18 @@ from .forms import RepoForm, ArchiveForm, ErrorForm, LocationForm from django.contrib.auth.decorators import permission_required from .utility import data from datetime import datetime, timedelta +from django.core.cache import cache def index(request): repo_list = Repo.objects.all() location_list = Location.objects.all() - repo_dict = repo_daily_dict(repo_list, 24) + # repo_dict = repo_daily_dict(repo_list, 24) context = { 'repo_list': repo_list, - 'hour_list': repo_dict, + # 'hour_list': repo_dict, 'location_list': location_list, } return render(request, 'borg/index.html', context) @@ -57,6 +58,7 @@ def post_repo(request): 'last_modified': cdata['last_modified'], 'label': label}) repo.save() + cache.clear() return HttpResponseRedirect(reverse('index')) else: @@ -85,6 +87,7 @@ def post_archive(request): archive = Archive(**archive_dict, repo=repo, cache=cache) archive.save() + cache.clear() return HttpResponseRedirect(reverse('index')) else: @@ -103,6 +106,7 @@ def post_error(request): error = Error(label=label, error=cdata['error'], time=cdata['time']) error.save() + cache.clear() return HttpResponseRedirect(reverse('index')) else: @@ -120,6 +124,7 @@ def post_location(request): label, _ = Location.objects.get_or_create(label=cdata['label'], defaults={"path": cdata["path"]}) label.save() + cache.clear() return HttpResponseRedirect(reverse('index')) else: