Ejemplo n.º 1
0
class TZTimeFramedModel(models.Model):
    other_model = models.ForeignKey(to='tests.TZWithGoodStringDefault',
                                    related_name='fk_to_tz_too')
    start = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                  populate_from=get_other_model_timezone,
                                  time_override=datetime.min.time())
    end = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                populate_from=get_other_model_timezone,
                                time_override=datetime.max.time())
Ejemplo n.º 2
0
class ModelWithForeignKeyToTimeZone(models.Model):
    other_model = models.ForeignKey(to='tests.TZWithGoodStringDefault',
                                    related_name='fk_to_tz')
    timestamp = LinkedTZDateTimeField(
        default=settings.TEST_DATETIME,
        populate_from=get_other_model_timezone,
    )
Ejemplo n.º 3
0
class Periods(models.Model):
    start = LinkedTZDateTimeField(time_override=datetime.min.time())
    end = LinkedTZDateTimeField(time_override=datetime.max.time())

    def __str__(self):
        return f'{self.start} {self.end}'
Ejemplo n.º 4
0
class ModelWithBadTimeZoneCharField(models.Model):
    timezone = models.CharField(default='Bad/Worse', max_length=64)
    timestamp = LinkedTZDateTimeField(
        default=settings.TEST_DATETIME,
        populate_from='timezone',
    )
Ejemplo n.º 5
0
class ModelWithBadPopulateFrom(models.Model):
    timezone = TimeZoneField(default='US/Eastern')
    timestamp = LinkedTZDateTimeField(
        default=settings.TEST_DATETIME,
        populate_from='invalid_field_reference',
    )
Ejemplo n.º 6
0
class ModelWithBadTimeOverride(models.Model):
    timestamp = LinkedTZDateTimeField(
        default=settings.TEST_DATETIME,
        time_override='<invalid>',
    )
Ejemplo n.º 7
0
class ModelWithLocalTZCharField(models.Model):
    timezone = models.CharField(default='US/Eastern', max_length=64)
    timestamp = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                      populate_from='timezone')
Ejemplo n.º 8
0
class ModelWithLocalTimeZone(models.Model):
    timezone = TimeZoneField(default='US/Eastern')
    timestamp = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                      populate_from='timezone')
Ejemplo n.º 9
0
class StaticTimeStampedModel(models.Model):
    start = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                  time_override=datetime_time(0, 0))
    end = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                time_override=datetime_time(
                                    23, 59, 59, 999999))
Ejemplo n.º 10
0
class CallableTimeStampedModel(models.Model):
    start = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                  time_override=datetime.min.time)
    end = LinkedTZDateTimeField(default=settings.TEST_DATETIME,
                                time_override=datetime.max.time)
Ejemplo n.º 11
0
class NullModelWithDateTimeOnly(models.Model):
    timestamp = LinkedTZDateTimeField(null=True, )
Ejemplo n.º 12
0
class ModelWithDateTimeOnly(models.Model):
    timestamp = LinkedTZDateTimeField(default=settings.TEST_DATETIME, )