django-timezone-field获取错误unicode对象没有属性区域

时间:2014-09-15 18:46:25

标签: python django django-timezone django-1.7

我无法在我的django 1.7中使用django-timezone-field的模型对象上进行迁移

我在这里找到了一个解决方案:https://github.com/mfogel/django-timezone-field/issues/12

我安装了django-time-field的分叉版本来解决这个问题:https://github.com/mfogel/django-timezone-field/issues/12

我现在收到错误:unicode object has no attribute zone'unicode' object has no attribute 'localize'

我正在调用这样的字段:timezone.activate(customer.time_zone.zone)

我的模型看起来像:

from timezone_field import TimeZoneField

class Customer(models.Model):
    user = models.OneToOneField(User, related_name="customer")
    time_zone = TimeZoneField()

如果这个分叉不好,我该如何迁移?除了时区之外还有其他解决方案吗?

1 个答案:

答案 0 :(得分:0)

这个fork修复了它,似乎是唯一适用于django 1.7 https://github.com/anhtran/django-timezone-field

的版本