slashmili / django-jalali

Jalali DateField support for Django model
http://pypi.python.org/pypi/django_jalali
BSD 3-Clause "New" or "Revised" License
252 stars 52 forks source link

Query For One Specific Month Is Not Working. #227

Closed Arshiatmi closed 10 months ago

Arshiatmi commented 10 months ago

:warning: Open an issue if you are facing an unexpected behavior or encountered bugs.

:information_source: Is this a feature request? Please report it here: https://github.com/slashmili/django-jalali/discussions/categories/ideas

:question: Do you have a question on how to use this library? ask your question here: https://github.com/slashmili/django-jalali/discussions/categories/q-a

Configurations

Hello. I Was Trying To Get All Transaction Of User That Are In One Specific Month But In Any Way Im Getting An Empty JQuerySet.

Code :

transactions.filter(datetime__month="8") # Returned <jQuerySet []> But I Have 2 Object In This Month
transactions.filter(datetime__month="08") # Returned <jQuerySet []> Again
transactions.filter(datetime__month="12") # Returned <jQuerySet []> But Its Correct.

I Tried To Confirm My Code Works , So I Did That :

for i in transactions:
      print(i.datetime.month)

And I've Got two 8 for My Objects. After That I Tried For Year And Year Works Correctly But Month Is Not.Then I Assumed I'm Using Library Correctly But Library Has A Bug.

Thanks ( mamnoon :) )

slashmili commented 10 months ago

Hey! Thanks for taking the time and reporting this.

Unfortunately we can't support __month, The reason behind it is explained in https://github.com/slashmili/django-jalali/issues/142#issuecomment-887464050