Пример #1
0
 def __init__(self, *args, **kwargs):
     minDate = kwargs.pop("minDate", None)
     if minDate:
         missionDuration = (date.today() - minDate).days / 30
         numberOfMonth = 24 + missionDuration
     else:
         numberOfMonth = 24
     kwargs["choices"] = [
         (i, formats.date_format(i, format="YEAR_MONTH_FORMAT"))
         for i in staffingDates(format="datetime", n=numberOfMonth, minDate=minDate)
     ]
     kwargs["choices"].insert(0, ("", ""))  # Add the empty choice for extra empty choices
     super(StaffingDateChoicesField, self).__init__(*args, **kwargs)
Пример #2
0
 def __init__(self, *args, **kwargs):
     minDate = kwargs.pop("minDate", None)
     if minDate:
         missionDuration = (date.today() - minDate).days / 30
         numberOfMonth = 24 + missionDuration
     else:
         numberOfMonth = 24
     kwargs["choices"] = [
         (i, formats.date_format(i, format="YEAR_MONTH_FORMAT"))
         for i in staffingDates(
             format="datetime", n=numberOfMonth, minDate=minDate)
     ]
     kwargs["choices"].insert(
         0, ("", ""))  # Add the empty choice for extra empty choices
     super(StaffingDateChoicesField, self).__init__(*args, **kwargs)