Exemplo n.º 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)
Exemplo n.º 2
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(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)
Exemplo n.º 3
0
def getTodaysGroupFlights():
    today = timezone.localtime(timezone.now()).date()
    return GROUP_FLIGHT_MODEL.get().objects.filter(name__startswith=today.strftime('%Y%m%d'))
Exemplo n.º 4
0
def getTodaysGroupFlights():
    today = timezone.localtime(timezone.now()).date()
    return GROUP_FLIGHT_MODEL.get().objects.filter(name__startswith=today.strftime('%Y%m%d'))