Changeset - 26ac00e8641f
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 2 years ago 2021-12-11 00:29:13
ben@sturm.com.au
assignment: Allow today's date.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/assignment/forms.py
Show inline comments
 
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():
 
    if value > timezone.now().date():
 
        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',
 
        help_text='You can use the day you first started contributing (or, equivalently, your date of birth), or any later date.',
 
        required=True,
 
        widget=forms.DateInput(attrs={'type': 'date'}),
 
        validators=[validate_in_past],
 
    )
 
    period_end_type = forms.ChoiceField(
0 comments (0 inline, 0 general)