예제 #1
0
파일: models.py 프로젝트: marcusti/times
 def calulate_time_and_week(self):
     year, week, day = self.date.isocalendar()
     self.week = week
     if self.start_time is not None and self.end_time is not None:
         self.working_time = get_working_time(self.start_time, self.end_time, self.break_minutes)
     else:
         self.working_time = 0.0
예제 #2
0
파일: forms.py 프로젝트: marcusti/times
 def validate_break_minutes(form, field):
     if form.end_time.data is not None:
         if get_working_time(form.start_time.data, form.end_time.data, field.data) <= 0:
             raise ValidationError('Working time may not be less then break time.')