Giter Club home page Giter Club logo

Comments (4)

stebunovd avatar stebunovd commented on August 30, 2024

thanks, good catch about timezone! Actually, this is not just about warnings. That behavior could result in weird situations when timezone is different between a database and Django settings, so I made a fix which sets timezone explicitly for both DateField and DateTimeField. Please check v0.8.6

as for TimeField - yeah, I suppose custom field would be a reasonable way to go

from djangoql.

AdamStelmaszczyk avatar AdamStelmaszczyk commented on August 30, 2024

Thanks, that looks great, now I can just have nice "2017-01-02" in my test (and DjangoQL will correctly set the timezone).

However, one test in my project that was passing before is now failing with AssertionError: 3 != 0:

http_status, response_json = self._get(
    '/users/user_1/meals/',
    {'filter': 'datetime_created ~ "2017-01-01"'},
)
assert_equal(3, response_json['count'])

I didn't know how to write "from a given day" on the first place (datetime_created = "2017-01-01" is not equivalent, it gets items from one second "2017-01-01 00:00:00").

I found out that datetime_created ~ "2017-01-01" worked. However it stopped working with 0.8.6.

Any advice?

from djangoql.

stebunovd avatar stebunovd commented on August 30, 2024

interesting. I never thought about LIKE comparisons for datetime fields, so it was supported basically by accident :) However, this is an obviously useful case, so I added explicit support for it as well. Your case should be working back with v0.8.8 (please let me know if it doesn't)

from djangoql.

AdamStelmaszczyk avatar AdamStelmaszczyk commented on August 30, 2024

Works like a charm, thank you.

from djangoql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.