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_prescription where date_prescribed '
 'between
"'+str(fromdate)+'" and "'+str(todate)+'"')

please review the documentation

https://docs.djangoproject.com/en/4.1/topics/db/sql/

I hope I have answered your question

Le lun. 12 sept. 2022 à 08:59, Muhammad Juwaini Abdul Rahman <
juwa...@gmail.com> a écrit :

> 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?
>>
>>
>> On Sun, Sep 11, 2022 at 9:47 AM Muhammad Juwaini Abdul Rahman <
>> juwa...@gmail.com> wrote:
>>
>>> 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 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 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__rang
>> e=[fromdate,todate])
>>
>> Regards,
>>
>>
>> On Fri, Sep 9, 2022 at 6:11 PM carlos  wrote:
>>
>>> Hello why use raw?
>>> query_results = Prescription.objects.filter(date__rang
>>> e=[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:48 AM tech george 
>>> wrote:
>>>
 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(request):
 if request.method=="POST":
 fromdate = request.POST.get('fromdate')
 todate = request.POST.get('todate')
 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_prescription where 
 date_precribed '
  'between 
 "'+str(fromdate)+'" and "'+str(todate)+'"')
 return render(request, 
 'pharmacist_templates/reports/referrals_report.html', {"data": 
 searchresults})

 else:
 displaydata = 
 Prescription.objects.filter(nurse=request.user.pharmacist).order_by('-id')
 return render(request, 
 'pharmacist_templates/reports/referrals_report.html', 
 {"data":displaydata})


 template

 [image: image.png]


 --
 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 django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CADYG20Go5PXJRP-MGJ07M36ftSaQ6WJVjYg_p4UYB9UUWge-LA%40mail.gmail.com
 
 .

>>>
>>>
>>> --
>>> att.
>>> Carlos Rocha
>>>
>>> --
>>> 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 django-users+unsubscr...@googlegroups.com.
>>> To vie

Re: Django server msg Error

2024-09-19 Thread KPADE Kouami Antoine
The problème IS simple juste going to registre your app in project on
setting.py file

Le jeu. 19 sept. 2024, 16:30, Gulshan Yadav  a
écrit :

> Please send me project name
>
> On Thu, Sep 19, 2024, 9:43 PM Gulshan Yadav 
> wrote:
>
>> Which one are you clone bro?
>>
>> On Thu, Sep 19, 2024, 9:18 PM RANGA BHARATH JINKA <
>> bharathjink...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> What's your project folder? Did you create a new app inside the project?
>>> You have registered your pages app URLs in the project. But you have to
>>> create a new urls.py file inside the app and import view
>>>
>>> On Thu, Sep 19, 2024 at 9:00 PM Anudeep Gudimalla <
>>> agudimall...@gmail.com> wrote:
>>>
 Hi Bharath,

 Thanks for reaching out.

 I have created the urls.py and views.py under pages folder and
 navigated as book says.

 please find the attachments.

 On Thu, Sep 19, 2024 at 11:08 AM RANGA BHARATH JINKA <
 bharathjink...@gmail.com> wrote:

> Hi,
>
> Did you create a view and link it to a URL like /home? Then, you have
> to go to that URL to see the message.
>
> Thanks,
> Bharath
>
> On Thu, Sep 19, 2024 at 8:31 PM Anudeep Gudimalla <
> agudimall...@gmail.com> wrote:
>
>> Hi all
>>
>> Firstly, im learning Django by book "Django for beginners - WSVincent
>> 5th edition" in chapter-2 i'm trying to up the server to display msg 
>> "Hello
>> World!". The development server was up but it does not shows the msg. can
>> anybody help me to  do it. Please find the screenshot  in attachment.
>>
>> Thank you.
>>
>> --
>> 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 django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a6d5026c-d037-4b03-9116-977736d050cfn%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Thanks and Regards
>
> J. Ranga Bharath
> cell: 9110334114
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAK5m315nCDeMXByg0QHOb%2B2R7_Y0Sqoin9R%2BH1Mk0XSMOMqOig%40mail.gmail.com
> 
> .
>
 --
 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 django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CADL3HBaww0uaAddRf4VymV1csp8fEVipHs%3D97_s3S6bYi-QgkQ%40mail.gmail.com
 
 .

>>>
>>>
>>> --
>>> Thanks and Regards
>>>
>>> J. Ranga Bharath
>>> cell: 9110334114
>>>
>>> --
>>> 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 django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAK5m316HNP5pkSdfiow7-Xkp54Ju14Pk9SRhc6FcPLAhVypKow%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFqcJsmmVYzGFzCgxc9E7xgfdSU5XSgySmDBFYvHpzGhMeNKVQ%40mail.gmail.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discuss