Re: Filter by date range

2022-09-12 Thread KPADE Kouami Antoine
Hey friend I think your problem is from searchresults = Prescription.objects.raw('select id,description,prescribe,ailment,ailment_2,ailment_3,' 'sickOff,referral,date_precribed,nurse_id,patient_id_id,' 'non_work_related_sickOff from pharmacy_pres

Re: Filter by date range

2022-09-12 Thread Muhammad Juwaini Abdul Rahman
You missed one quote ". On Mon, 12 Sept 2022 at 14:04, tech george wrote: > Hello, > > I have tried debugging as below and it returned data; > > search_results = > Prescription.objects.filter(date_prescribed__range=["2022-07-01",2022-07-30"]) > > Is there another way i can filter the dates? > >

Re: Filter by date range

2022-09-11 Thread tech george
I managed to solve the issue. I was using the wrong keyword to fetch the dates. Thanks for the support. On Mon, Sep 12, 2022 at 9:03 AM tech george wrote: > Hello, > > I have tried debugging as below and it returned data; > > search_results = > Prescription.objects.filter(date_prescribed__ran

Re: Filter by date range

2022-09-11 Thread tech george
Hello, I have tried debugging as below and it returned data; search_results = Prescription.objects.filter(date_prescribed__range=["2022-07-01",2022-07-30"]) Is there another way i can filter the dates? On Sun, Sep 11, 2022 at 9:47 AM Muhammad Juwaini Abdul Rahman < juwa...@gmail.com> wrote: >

Re: Filter by date range

2022-09-10 Thread Muhammad Juwaini Abdul Rahman
Either there's no data for that month or your query is wrongly formatted. Probably you can try your query in the shell first. On Sun, 11 Sept 2022 at 02:12, tech george wrote: > Hello Muhammad, > > I'm choosing dates between 2022-07-01 and 2022-07-30 which have records in > the db. > > I hope i

Re: Filter by date range

2022-09-10 Thread carlos
hello try debug query_results = Prescription.objects.filter(date__range=["2022-07-01"," 2022-07-30"]) len(query_results) if come with records so, fromdate and todate is the problem! On Sat, Sep 10, 2022 at 12:12 PM tech george wrote: > Hello Muhammad, > > I'm choosing dates between 2022-07-01 an

Re: Filter by date range

2022-09-10 Thread tech george
Hello Muhammad, I'm choosing dates between 2022-07-01 and 2022-07-30 which have records in the db. I hope i have answered you right. On Sat, Sep 10, 2022 at 8:41 AM Muhammad Juwaini Abdul Rahman < juwa...@gmail.com> wrote: > What's your value of 'fromdate' and 'todate'? > > On Sat, 10 Sept 202

Re: Filter by date range

2022-09-09 Thread Muhammad Juwaini Abdul Rahman
What's your value of 'fromdate' and 'todate'? On Sat, 10 Sept 2022 at 13:27, tech george wrote: > Hello Carlos, > > I have used the code below as you advised by when I filter the table comes > blank: > > query_results = Prescription.objects.filter(date__range=[fromdate,todate]) > > Regards, > >

Re: Filter by date range

2022-09-09 Thread tech george
Hello Carlos, I have used the code below as you advised by when I filter the table comes blank: query_results = Prescription.objects.filter(date__range=[fromdate,todate]) Regards, On Fri, Sep 9, 2022 at 6:11 PM carlos wrote: > Hello why use raw? > query_results = Prescription.objects.filter(

Re: Filter by date range

2022-09-09 Thread carlos
Hello why use raw? query_results = Prescription.objects.filter(date__range=[fromdate,todate]) if you have any problem with performance hit database use select_related or used m2m field use prefect_related https://docs.djangoproject.com/en/4.1/ref/models/querysets/ best! On Fri, Sep 9, 2022 at 7:4