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

Filter by date range

2022-09-09 Thread tech george
Hello friends! I am trying to give users an easier way to filter data by date range. My views.py code is as below, but unfortunately, it is hiding data without applying the filter whenever I try to use if, else statements. Please advise what I might be doing wrong. views.py ef referralsReports

Re: Python Sqlalchemy filter by date range

2018-04-24 Thread sum abiut
Thanks heaps Larry On Tue, Apr 24, 2018 at 10:40 PM, Larry Martell wrote: > I think you are looking for the range function > > https://docs.djangoproject.com/en/dev/ref/models/querysets/#range > > > On Mon, Apr 23, 2018 at 11:54 PM sum abiut wrote: > >> I have two date picker fields that i want

Re: Python Sqlalchemy filter by date range

2018-04-24 Thread Larry Martell
I think you are looking for the range function https://docs.djangoproject.com/en/dev/ref/models/querysets/#range On Mon, Apr 23, 2018 at 11:54 PM sum abiut wrote: > I have two date picker fields that i want the users to select from date to > end date. and i want to display data between the two

Python Sqlalchemy filter by date range

2018-04-23 Thread sum abiut
I have two date picker fields that i want the users to select from date to end date. and i want to display data between the two dates that was selected. From example form date: 2/14/2018 to date:3/15/2018. when the function is called i want to extract and display data between this two dates. i jus