私はdjango 1.4の機能をテストしています。私にとって最も重要なのは TZ コントロールです。
私はPGを使用しており、DateTimeFieldは完璧に機能しており、日時をカウントして保存しています。settings.TIME_ZONE
また、他のさまざまなタイムゾーンを設定していてpytz
、見栄えがします。
しかし、問題はtimesince tagにあり、TZ を無視しています:
from django.utils import timezone
from django.utils.timesince import timeuntil
class Foo(models.Model):
date = models.DateTimeField()
def remaining(self):
res = timeuntil(self.date, datetime.datetime.now(tz=timezone.get_current_timezone()))
return res
foo.remaining()
デフォルトのタイムゾーンで常に残りのカウントを返しています。
前もって感謝します。