Skip to content
Snippets Groups Projects
Commit afb39799 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Check project dates (better implementation)

parent 57292428
No related branches found
No related tags found
No related merge requests found
......@@ -775,8 +775,7 @@ class ProjectApplicationForm(forms.ModelForm):
def clean_start_date(self):
start_date = self.cleaned_data.get('start_date')
if not self.precursor_application:
now = datetime.now()
if start_date and now - start_date > timedelta(days=1):
if start_date and (start_date - datetime.now()).days < 0:
raise forms.ValidationError(
_(astakos_messages.INVALID_PROJECT_START_DATE))
return start_date
......@@ -785,10 +784,10 @@ class ProjectApplicationForm(forms.ModelForm):
start_date = self.cleaned_data.get('start_date')
end_date = self.cleaned_data.get('end_date')
now = datetime.now()
if end_date and now - end_date > timedelta(days=1):
if end_date and (end_date - now).days < 0:
raise forms.ValidationError(
_(astakos_messages.INVALID_PROJECT_END_DATE))
if start_date and end_date <= start_date:
if start_date and (end_date - start_date).days <= 0:
raise forms.ValidationError(
_(astakos_messages.INCONSISTENT_PROJECT_DATES))
return end_date
......
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