From 7374c9f91528f99b03cdec79215c707b57b8f8f1 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Fri, 17 Dec 2021 10:54:47 +1100 Subject: [PATCH] assignment: Accept current date anywhere on earth. --- www/conservancy/apps/assignment/forms.py | 6 +++++- www/conservancy/templates/assignment/assignment_form.html | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/www/conservancy/apps/assignment/forms.py b/www/conservancy/apps/assignment/forms.py index a55f07a9..1497e978 100644 --- a/www/conservancy/apps/assignment/forms.py +++ b/www/conservancy/apps/assignment/forms.py @@ -1,3 +1,5 @@ +import datetime + from django import forms from django.core.validators import ValidationError from django.utils import timezone @@ -7,7 +9,9 @@ from .terms import TERMS def validate_in_past(value): - if value > timezone.now().date(): + # Adding a day to allow the current date anywhere on earth, regardless of + # the server timezone. + if value > timezone.now().date() + datetime.timedelta(days=1): raise ValidationError('Enter a date in the past') diff --git a/www/conservancy/templates/assignment/assignment_form.html b/www/conservancy/templates/assignment/assignment_form.html index c54355b1..5ef74338 100644 --- a/www/conservancy/templates/assignment/assignment_form.html +++ b/www/conservancy/templates/assignment/assignment_form.html @@ -12,6 +12,11 @@
{% csrf_token %} + + {% if form.errors %} +

Please review the errors below.

+ {% endif %} + {{ form.as_p }}

Please be aware that your employer or a contractor may own the rights in your work by virtue of their employment of you or by explicit transfer of ownership in an agreement. We recommend you review any relevant agreements or consult with a lawyer if you are not sure.