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())
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, )
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}'
class ModelWithBadTimeZoneCharField(models.Model): timezone = models.CharField(default='Bad/Worse', max_length=64) timestamp = LinkedTZDateTimeField( default=settings.TEST_DATETIME, populate_from='timezone', )
class ModelWithBadPopulateFrom(models.Model): timezone = TimeZoneField(default='US/Eastern') timestamp = LinkedTZDateTimeField( default=settings.TEST_DATETIME, populate_from='invalid_field_reference', )
class ModelWithBadTimeOverride(models.Model): timestamp = LinkedTZDateTimeField( default=settings.TEST_DATETIME, time_override='<invalid>', )
class ModelWithLocalTZCharField(models.Model): timezone = models.CharField(default='US/Eastern', max_length=64) timestamp = LinkedTZDateTimeField(default=settings.TEST_DATETIME, populate_from='timezone')
class ModelWithLocalTimeZone(models.Model): timezone = TimeZoneField(default='US/Eastern') timestamp = LinkedTZDateTimeField(default=settings.TEST_DATETIME, populate_from='timezone')
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))
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)
class NullModelWithDateTimeOnly(models.Model): timestamp = LinkedTZDateTimeField(null=True, )
class ModelWithDateTimeOnly(models.Model): timestamp = LinkedTZDateTimeField(default=settings.TEST_DATETIME, )