Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
# Awi Access (Django App)
# By Natasha L.
# |
# =================
# Forms
# =================
import datetime
from django import forms
from django.forms import extras
from django.utils import dateparse
from django.utils import timezone
years_list = sorted(range(,, reverse=True)
class age_verify_form(forms.Form):
error_css_class = 'has_error';
birthdate = forms.DateField(label='Your Birthdate', widget=extras.SelectDateWidget(years=years_list))
def validate_age(self):
dob = self.cleaned_data['birthdate']
cur =
min_age = cur.replace(year=cur.year-18)
if self.cleaned_data['birthdate'] < min_age:
dob_valid = True
dob_valid = False
return dob_valid