diff --git a/coinmanager/coinc/cache.py b/coinmanager/coinc/cache.py index 79a5ef0..7c2fd49 100644 --- a/coinmanager/coinc/cache.py +++ b/coinmanager/coinc/cache.py @@ -27,17 +27,17 @@ from django.http import Http404 from .models import Coin -def get_last_modified_index(request): - return cache.get(f'last_modified_index', set_last_modified_index()) +def get_last_modified_coin(request): + return cache.get('last_modified_coin', set_last_modified_coin()) -def set_last_modified_index(): +def set_last_modified_coin(): ''' set and return the datetime of the last coin added ''' try: last_modified = Coin.objects.latest('date_modified').date_modified except Coin.DoesNotExist: raise Http404(f'Das Land "{name_iso}" existiert nicht') - cache.set(f'last_modified_index', last_modified) + cache.set('last_modified_coin', last_modified) return last_modified diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py index 35eff64..98bdfaa 100644 --- a/coinmanager/coinc/views.py +++ b/coinmanager/coinc/views.py @@ -27,13 +27,13 @@ from django.template import loader from django.template.defaultfilters import register from django.views.decorators.http import condition -from .cache import (get_last_modified_index, set_last_modified_index, +from .cache import (get_last_modified_coin, set_last_modified_coin, get_last_modified_country, set_last_modified_country) from .models import Country, Stamp, Coin, User from .helper import total_coin_sum, coin_sum_of_ -@condition(last_modified_func=get_last_modified_index) +@condition(last_modified_func=get_last_modified_coin) def index(request): ''' index view ''' @@ -378,7 +378,7 @@ def add_coin(request): in_collector = ec, exists = exists) - set_last_modified_index() + set_last_modified_coin() set_last_modified_country(country.name_iso) return response()