When you print the SQL query that is executed on the database

print lista_de_balada.query

Does it make sense?

When you see the actual value stored in the database is it stored correctly?

Also remember that the month and day are 1-based (january is 1, february is
2, etc)

Suerte! :D



On Sun, Dec 21, 2014 at 11:04 AM, Rafael Borella <[email protected]>
wrote:

> Hi,  i'm new in django and python,
>
> I'm trying to create a queryset to filter according to date.
>
> this is my MODEL :  data = models.DateTimeField()
>
> and my VIEW:        def resultado(request, dia, mes, ano):
>                            lista_de_balada=
> Balada.objects.filter(data__year=ano, data__month=mes, data__day=dia)
>                            context = {'lista_de_balada':lista_de_balada}
>                            return render(request, 'procurar.htm', context)
>
> it presents no errors, but the query is aways empty...    if i take off   
> __month
>     and    __day  it works fine.   but i need to filter according to date
>  not only year.
>
> Sorry for the english, is not my native language.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/948e257d-f704-4dd5-8797-750ba253bcec%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/948e257d-f704-4dd5-8797-750ba253bcec%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1W3eBcQQk_jmpJy4%2B6EHeW4sQzvEPaFanbi4eUwD1Q5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to