Exemple #1
0
    def delete(self):
        if self.deleted_uuid:
            raise self.RedeletedError, self.pk

        self.deleted_uuid = generate_uuid()
        self.deleted_at = datetime.now()
        self.save()
Exemple #2
0
    def delete(self):
        if self.deleted_uuid:
            raise self.RedeletedError, self.pk

        self.deleted_uuid = generate_uuid()
        self.deleted_at = datetime.now()
        self.save()
Exemple #3
0
    def get_day_of_the_week_column(self):
        """
        現在の曜日のカラム名を返す

        :return:
        :rtype: str
        """
        return self.WEEK_COLUMN_DICT.get(datetime.now().weekday())
Exemple #4
0
    def get_day_of_the_week_column(self):
        """
        現在の曜日のカラム名を返す

        :return:
        :rtype: str
        """
        return self.WEEK_COLUMN_DICT.get(datetime.now().weekday())
Exemple #5
0
    def is_active(self):
        """
        現在、指定時間内であれば有効

        :rtype: bool
        """
        # 多重継承で他クラスで期間外判定なら期間外とする
        result = super(DailyCycleMixin, self).is_active()
        if not result:
            return False

        # 現在の時間 hhmm (type int)
        now = datetime.now().hour * 100 + datetime.now().minute

        if self.day_end_at == 0:
            # 終了時間未設定の場合は終日
            return self._is_on_term(now, self.day_start_at, None)
        else:
            return self._is_on_term(now, self.day_start_at, self.day_end_at)
Exemple #6
0
    def is_active(self):
        """
        現在、指定時間内であれば有効

        :rtype: bool
        """
        # 多重継承で他クラスで期間外判定なら期間外とする
        result = super(DailyCycleMixin, self).is_active()
        if not result:
            return False

        # 現在の時間 hhmm (type int)
        now = datetime.now().hour * 100 + datetime.now().minute

        if self.day_end_at == 0:
            # 終了時間未設定の場合は終日
            return self._is_on_term(now, self.day_start_at, None)
        else:
            return self._is_on_term(now, self.day_start_at, self.day_end_at)
Exemple #7
0
    def is_active(self):
        """
        毎月、指定された日付の間であれば有効

        :return:
        :rtype: bool
        """
        # 多重継承で他クラスで期間外判定なら期間外とする
        result = super(MonthlyCycleMixin, self).is_active()
        if not result:
            return False

        # 現在の日付 dd
        now = datetime.now().day
        if self.month_end_at == 0:
            # 終了日未設定の場合は月末まで
            return self._is_on_term(now, self.month_start_at, None)
        else:
            return self._is_on_term(now, self.month_start_at, self.month_end_at)
Exemple #8
0
    def is_active(self):
        """
        毎月、指定された日付の間であれば有効

        :return:
        :rtype: bool
        """
        # 多重継承で他クラスで期間外判定なら期間外とする
        result = super(MonthlyCycleMixin, self).is_active()
        if not result:
            return False

        # 現在の日付 dd
        now = datetime.now().day
        if self.month_end_at == 0:
            # 終了日未設定の場合は月末まで
            return self._is_on_term(now, self.month_start_at, None)
        else:
            return self._is_on_term(now, self.month_start_at,
                                    self.month_end_at)
Exemple #9
0
 def delete(self):
     return self.update(deleted_uuid=generate_uuid(),
                        deleted_at=datetime.now())
Exemple #10
0
 def delete(self):
     return self.update(deleted_uuid=generate_uuid(),
                        deleted_at=datetime.now())
Exemple #11
0
 def is_in_term(self):
     """
     期間外なら False
     """
     now = datetime.now()
     return self._is_on_term(now, self.start_at, self.end_at)
Exemple #12
0
 def is_in_term(self):
     now = datetime.now()
     return self.filter(start_at__lte=now, end_at__gt=now)
Exemple #13
0
 def is_in_term(self):
     """
     期間外なら False
     """
     now = datetime.now()
     return self._is_on_term(now, self.start_at, self.end_at)
Exemple #14
0
 def is_in_term(self):
     now = datetime.now()
     return self.filter(start_at__lte=now, end_at__gt=now)