Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F() expressions with dates bug #15

Open
artynusov opened this issue Feb 19, 2013 · 1 comment
Open

F() expressions with dates bug #15

artynusov opened this issue Feb 19, 2013 · 1 comment

Comments

@artynusov
Copy link

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.

@BertrandBordage
Copy link
Contributor

Same issue here. I'm even getting AttributeError: 'F' object has no attribute 'days'.
With Django 1.5.5 & johnny-cache 1.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants