I want to fetch all bookings for the users organization_id between
start_date and end_date.
I am achieving this via this queryset, however, as soon as I add the second
filter (*bold*), it is not rendered in the template anymore and I,
therefore, do not see it in my HTML file.
context['bookings']=Booking.objects.filter(
Q(organization_id=request.user.organization_id), *Q(booking_time__range=
(start_date, end_date))*)

Thank you so much for your help.
Best wishes,

Manuel



Manuel Buri
T:  +41 79 933 01 11
M: [email protected]
W: www.manuelburi.com <http://manuelburi.com/?utm_source=gmail>


On Fri, 19 Mar 2021 at 22:07, Anornymous u <[email protected]> wrote:

> I mean what you want to fetch and the conditions
>
> On Fri, Mar 19, 2021, 16:01 Manuel Buri <[email protected]> wrote:
>
>> Hi,
>>
>> I am having this query set in my view:
>> context['bookings']=Booking.objects.filter(
>> Q(organization_id=request.user.organization_id), *Q(booking_time__range=
>> (start_date, end_date))*)
>>
>> It produces a *non-empty* query set!
>> However, I am NOT able to display it in my template.
>>
>> If I get *rid* of Q(booking_time__range= (start_date, end_date) and only
>> do:
>>
>> context['bookings']=Booking.objects.filter( 
>> Q(organization_id=request.user.organization_id))
>> then it is also non-empty AND it is displaying it in my template.
>>
>> *What am I missing here?*
>>
>> Thank you for your help.
>>
>> Manuel
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/76f85c72-19f9-4ad3-a39b-01dc60aa6da5n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/76f85c72-19f9-4ad3-a39b-01dc60aa6da5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/2DC9EY75yuM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMXTB%3DcsfYRqGPbhXncaHNTjKqVhgskST8BDEAY-2fYonemfdg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMXTB%3DcsfYRqGPbhXncaHNTjKqVhgskST8BDEAY-2fYonemfdg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACx7KOQEEWWNu6hQwMXdEP_nZ6%2Bex9HZ9KEiVubrvd89%3DTP%3DuQ%40mail.gmail.com.

Reply via email to