johnny-cache
johnny-cache copied to clipboard
F() expressions with dates bug
Johnny does not properly work with F() expression when it comes to dates, here is an example:
>>> from django.db.models import F
>>> from johnny import cache
>>> cache.enable()
>>> SomeData.objects.create(period_start=datetime.datetime.now() - datetime.timedelta(seconds=3600), period_end=datetime.datetime.now())
<SomeData: SomeData object>
>>> SomeData.objects.filter(period_start__lt=F('period_end') - datetime.timedelta(seconds=1))
[]
>>> cache.disable()
>>> SomeData.objects.filter(period_start__lt=F('period_end') - datetime.timedelta(seconds=1))
[<SomeData: SomeData object>]
First query was supposed to return newly created SomeData objects because period_start is 3600 seconds behind period_end. After disabling Johnny it works fine.
Django 1.4.3, Johnny 1.4.
Same issue here. I'm even getting AttributeError: 'F' object has no attribute 'days'
.
With Django 1.5.5 & johnny-cache 1.4.