Commit 103d91a7 authored by VAN ZUIJLEN Nils's avatar VAN ZUIJLEN Nils Committed by VAN ZUIJLEN Nils
Browse files

Invalid member list cache on new contributions



Signed-off-by: VAN ZUIJLEN Nils's avatarNils VAN ZUIJLEN <nils.van-zuijlen@mailo.com>
parent 8789a0f1
...@@ -4,6 +4,8 @@ from typing import Tuple ...@@ -4,6 +4,8 @@ from typing import Tuple
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models
from core.cache import invalid_cache
CONTRIBUTION_TYPES = [ CONTRIBUTION_TYPES = [
("half", "Demi-cotisation"), ("half", "Demi-cotisation"),
...@@ -31,6 +33,8 @@ class Contributor(models.Model): ...@@ -31,6 +33,8 @@ class Contributor(models.Model):
else: else:
end_date = datetime.date(now.year, 12, 31) end_date = datetime.date(now.year, 12, 31)
invalid_cache("members")
return Contributor.objects.update_or_create( return Contributor.objects.update_or_create(
{"end_date": end_date, "type": "half", "means_of_payment": mean}, user=user {"end_date": end_date, "type": "half", "means_of_payment": mean}, user=user
) )
...@@ -45,6 +49,8 @@ class Contributor(models.Model): ...@@ -45,6 +49,8 @@ class Contributor(models.Model):
else: else:
end_date = datetime.date(now.year + 1, 6, 30) end_date = datetime.date(now.year + 1, 6, 30)
invalid_cache("members")
return Contributor.objects.update_or_create( return Contributor.objects.update_or_create(
{"end_date": end_date, "type": "full", "means_of_payment": mean}, user=user {"end_date": end_date, "type": "full", "means_of_payment": mean}, user=user
) )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment