django-timezone-field gets error unicode object ha

2019-09-17 06:51发布

I was not able to do a migration on one of my model objects that use django-timezone-field in django 1.7

I found a solution here: https://github.com/mfogel/django-timezone-field/issues/12

I installed the forked version of django-time-field which fixed this problem: https://github.com/mfogel/django-timezone-field/issues/12

I now get the error: unicode object has no attribute zone and 'unicode' object has no attribute 'localize'

I am calling the field like this: timezone.activate(customer.time_zone.zone)

My model looks like:

from timezone_field import TimeZoneField

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

If this fork is no good, how can I migrate? Is there any other solution besides time zone field?

1条回答
家丑人穷心不美
2楼-- · 2019-09-17 07:08

This fork fixed it and seems to be the only version that works with django 1.7 https://github.com/anhtran/django-timezone-field

查看更多
登录 后发表回答