Skip to content

Commit

Permalink
Fix hardcoded donation limit
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed May 26, 2024
1 parent 19de6f1 commit 67d2edb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion backend/donations/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
6 changes: 5 additions & 1 deletion backend/donations/views/ngo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 67d2edb

Please sign in to comment.