예제 #1
0
 def clean_published_date(self):
     date_time = self.cleaned_data['published_date']
     asia_time = get_asia_time()
     if date_time:
         if str(date_time) < str(asia_time):
             raise forms.ValidationError('The date cannot be in the past!')
         if str(self.data['job_type']) == 'walk-in':
             if 'walkin_to_date' in self.cleaned_data.keys() and self.cleaned_data['walkin_to_date'] > date_time.date():
                 return date_time
             else:
                 raise forms.ValidationError(
                     'Published date must be less than walkin end date')
         return date_time
예제 #2
0
 def clean_published_date(self):
     date_time = self.cleaned_data["published_date"]
     asia_time = get_asia_time()
     if date_time:
         if str(date_time) < str(asia_time):
             raise forms.ValidationError("The date cannot be in the past!")
         if str(self.data["job_type"]) == "walk-in":
             if ("walkin_to_date" in self.cleaned_data.keys()
                     and self.cleaned_data["walkin_to_date"] >
                     date_time.date()):
                 return date_time
             else:
                 raise forms.ValidationError(
                     "Published date must be less than walkin end date")
         return date_time