コード例 #1
0
    def pre_save(self, model_instance, add):
        if not backportTimeZone():
            return super(DateTimeUtcField, self).pre_save(model_instance, add)

        if self.auto_now or (self.auto_now_add and add):
            value = timezone.now()
            setattr(model_instance, self.attname, value)
            return value
        else:
            # Note this is purposefully calling the pre_save() method
            # from the super-super-class, not the super-class.
            return super(DateTimeField, self).pre_save(model_instance, add)
コード例 #2
0
ファイル: dateTimeUtc.py プロジェクト: geocam/geocamUtilWeb
    def pre_save(self, model_instance, add):
        if not backportTimeZone():
            return super(DateTimeUtcField, self).pre_save(model_instance, add)

        if self.auto_now or (self.auto_now_add and add):
            value = timezone.now(pytz.utc)
            setattr(model_instance, self.attname, value)
            return value
        else:
            # Note this is purposefully calling the pre_save() method
            # from the super-super-class, not the super-class.
            return super(DateTimeField, self).pre_save(model_instance, add)
コード例 #3
0
ファイル: views.py プロジェクト: sophsoph321/xgds_planner2
def getTodaysGroupFlights():
    today = timezone.localtime(timezone.now()).date()
    return GROUP_FLIGHT_MODEL.get().objects.filter(name__startswith=today.strftime('%Y%m%d'))
コード例 #4
0
ファイル: views.py プロジェクト: xgds/xgds_planner2
def getTodaysGroupFlights():
    today = timezone.localtime(timezone.now()).date()
    return GROUP_FLIGHT_MODEL.get().objects.filter(name__startswith=today.strftime('%Y%m%d'))