From 67d2edb0155cb243995f7bcff6bfcd876a1a360e Mon Sep 17 00:00:00 2001 From: Tudor Amariei Date: Sun, 26 May 2024 12:51:03 +0300 Subject: [PATCH] Fix hardcoded donation limit --- backend/donations/views/api.py | 6 +++++- backend/donations/views/ngo.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/donations/views/api.py b/backend/donations/views/api.py index 2959266d..8ff42b40 100644 --- a/backend/donations/views/api.py +++ b/backend/donations/views/api.py @@ -180,7 +180,11 @@ def post(self, request, *args, **kwargs): except Job.DoesNotExist: pass - DONATION_LIMIT = date(timezone.now().year, 5, 25) + DONATION_LIMIT = date( + year=settings.DONATION_LIMIT_YEAR, + month=settings.DONATION_LIMIT_MONTH, + day=settings.DONATION_LIMIT_DAY, + ) if timezone.now().date() > DONATION_LIMIT: return redirect(reverse("contul-meu")) diff --git a/backend/donations/views/ngo.py b/backend/donations/views/ngo.py index 775a017d..47973cb0 100644 --- a/backend/donations/views/ngo.py +++ b/backend/donations/views/ngo.py @@ -38,7 +38,11 @@ def get_context_data(self, ngo_url, **kwargs): def get(self, request, ngo_url, *args, **kwargs): context = self.get_context_data(ngo_url) - donation_limit = date(timezone.now().year, 5, 25) + donation_limit = date( + year=settings.DONATION_LIMIT_YEAR, + month=settings.DONATION_LIMIT_MONTH, + day=settings.DONATION_LIMIT_DAY, + ) try: donor = Donor.objects.get(pk=request.session.get("donor_id", 0))