Skip to content
Snippets Groups Projects
Commit 6f21f927 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

visit can be planned only in the next 5 years (not 100 years in the

past)
parent 6865dedf
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ Possible redundancy, but if need arises, contents of forms can be easily customi
CURRENT_YEAR = datetime.now().year
YEAR_CHOICES=tuple(range(CURRENT_YEAR,CURRENT_YEAR - 120, -1))
FUTURE_YEAR_CHOICES=tuple(range(CURRENT_YEAR,CURRENT_YEAR + 5, 1))
def validate_subject_nd_number(self):
subject = self.cleaned_data
......@@ -130,10 +131,10 @@ class AppointmentAddForm(ModelForm):
class VisitDetailForm(ModelForm):
datetime_begin = forms.DateField(label="Visit begins on",
widget=forms.SelectDateWidget(years=YEAR_CHOICES)
widget=forms.SelectDateWidget(years=FUTURE_YEAR_CHOICES)
)
datetime_end = forms.DateField(label="Visit ends on",
widget=forms.SelectDateWidget(years=YEAR_CHOICES)
widget=forms.SelectDateWidget(years=FUTURE_YEAR_CHOICES)
)
class Meta:
......@@ -142,10 +143,10 @@ class VisitDetailForm(ModelForm):
class VisitAddForm(ModelForm):
datetime_begin = forms.DateField(label="Visit begins on",
widget=forms.SelectDateWidget(years=YEAR_CHOICES)
widget=forms.SelectDateWidget(years=FUTURE_YEAR_CHOICES)
)
datetime_end = forms.DateField(label="Visit ends on",
widget=forms.SelectDateWidget(years=YEAR_CHOICES)
widget=forms.SelectDateWidget(years=FUTURE_YEAR_CHOICES)
)
class Meta:
model = Visit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment