File diff 6e380dba29b3 → 7374c9f91528
www/conservancy/apps/assignment/forms.py
Show inline comments
 
import datetime
 

	
 
from django import forms
 
from django.core.validators import ValidationError
 
from django.utils import timezone
 

	
 
from .models import Assignment
 
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')
 

	
 

	
 
class AssignmentForm(forms.ModelForm):
 
    period_begins = forms.DateField(
 
        label='Assign the copyright in my above contributions starting on',