Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
my friend, I'm checking your code, and I can't continue without seeing the template and how you make the request. However I will try to make a dissection of the code to evaluate what happens, so I will forward your code to you in the pastebin link with some notes: https://pastebin.com/QbxqcTrh N

Re: View / Query Set not showing with filter

2021-03-19 Thread Arisophy
Hi Manuelf I understand what you say. Now, I think It's not the problem of Querym , too. The problem is that field data is not displayed in HTML. You use the wrong variable name "office" in Template. try this. (View) context['office'] = ↓ context['offices'] = ... (Template) × {% for off

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
*Booking Model* from django.db import models from django.utils import timezone from users.models import Account from organization.models import Organization, Office class Booking(models.Model): LOCATION_OPTIONS = ( ('H', 'Home Office'), ('O', 'Office'), ('N

Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
Can you share your "Booking" model and the view (function or class) that renders the template?, and I beg you, please use pastebin.com for share your code :D El vie, 19 mar 2021 a las 16:17, Manuel Buri () escribió: > @anornymou...@gmail.com and ima...@gmail.com > your suggestion is unfortunately

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
@anornymou...@gmail.com and ima...@gmail.com your suggestion is unfortunately not working too @All: So as said my queryset is not empty, meaning that the query works. However, the results is not in the rendered HTML file. This would imply that with my template is something wrong, don't you think?

Re: View / Query Set not showing with filter

2021-03-19 Thread Thomas Lockhart
Why use Q? afaict simple filter syntax should get you what you want. Booking.objects.filter(organization_id=request.user.organization_id, booking_time__range= (start_date, end_date)) Not sure if this will get you closer to the query you expect. You might also find it useful to use "./manage.py

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
Yes, I this can work On Sat, Mar 20, 2021, 00:17 Héctor Alonso Lozada Echezuría wrote: > I think you should reconsider the query > > context['bookings']=Booking.objects.filter(Q(organization_id=request.user.organization_id), > Q(booking_time__date__gte=start_date), > Q(booking_time__date__lte=e

Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
I think you should reconsider the query context['bookings']=Booking.objects.filter(Q(organization_id=request.user.organization_id), Q(booking_time__date__gte=start_date), Q(booking_time__date__lte=end_date))) El vie, 19 mar 2021 a las 15:14, Héctor Alonso Lozada Echezuría (< ima...@gmail.com>) es

Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
https://docs.djangoproject.com/en/3.1/ref/models/querysets/#range [image: image.png] El vie, 19 mar 2021 a las 15:12, Manuel Buri () escribió: > 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

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
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']=Bo

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
I mean what you want to fetch and the conditions On Fri, Mar 19, 2021, 16:01 Manuel Buri 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))*) >

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
Tell us exactly what you are looking for from your query On Fri, Mar 19, 2021, 16:01 Manuel Buri 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_dat

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
the field is this (copied from my Model): booking_time= models.DateTimeField(default=timezone.now) sent from my phone. sorry for typos. On Fri, 19 Mar 2021, 21:28 Anornymous u, wrote: > What is the name of the field, this part that reads range > > On Fri, Mar 19, 2021, 16:01 Manuel Bu

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
What is the name of the field, this part that reads range On Fri, Mar 19, 2021, 16:01 Manuel Buri 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_da

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
Hi Tom, thanks for getting back to me. As said, it is super weird: both start_date and end_date are both datetime.datetime. furthermore the queryset is as said non-empty: ), 'location': 'H'}, {'id': 10, 'account_id': 4, 'organization_id': 11, 'office_id': 1, 'booking_time': datetime.datetime(2021

Re: View / Query Set not showing with filter

2021-03-19 Thread Thomas Lockhart
Almost certainly start_date and end_date are not what you expect. Do the types match? In any case print them out and see what you are actually getting. hth - Tom > On Mar 19, 2021, at 6:00 AM, Manuel Buri wrote: > > Hi, > > I am having this query set in my view: > context['bookings']=Bookin

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
Hi Nagaraju May I ask if your question is related to my post? Thanks a lot, Manuel sent from my phone. sorry for typos. On Fri, 19 Mar 2021, 19:10 Nagaraju Singothu, wrote: > Dear connectors, > > Please let me know, what is double tap in python?. Any tutorials > available in YouTube. > >

Re: View / Query Set not showing with filter

2021-03-19 Thread Nagaraju Singothu
Dear connectors, Please let me know, what is double tap in python?. Any tutorials available in YouTube. On Fri 19 Mar, 2021, 6:31 PM Manuel Buri, wrote: > Hi, > > I am having this query set in my view: > context['bookings']=Booking.objects.filter( > Q(organization_id=request.user.organizati