date of birth correction

This commit is contained in:
Martin Quarda 2024-02-28 11:59:51 +01:00
parent 32b15caef4
commit c0031f55c2

View File

@ -15,7 +15,7 @@ def register(request):
if User.objects.filter(email=request.POST['email']):
return HttpResponse('{"reason":"Email je již registrován!"}', status=400, content_type='application/json')
try:
dat = datetime.strptime(request.POST['date_of_birth'], "%d/%m/%Y").date()
dat = datetime.strptime(request.POST['date_of_birth'], "%Y-%m-%d").date()
if dat > date(2006, 5, 4):
return HttpResponse('{"reason":"Je potřeba mít 18 let v den závodu!"}', status=400, content_type='application/json')
elif dat < date(1924, 5, 4):