DRF and React - request.user is "Anonymous user"

2022-09-11 Thread Jackson Patrick
I have used simple JWT for authentication and i have successfully logged in
and am getting tokens also. But when i do a request.user in backend i get
"Annonymous user".
Tried passing Authorization header in axios post in FE REACT but it throws
error. Am setting both refresh and access in a state variable and store it
in local storage . Am really new into this and I'm totally stuck here.

All i did was to temporarily solve the issue is to send the user id from
frontend to backend and by the way it's a bad practice.

So please help me out in this guys.

-- 
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/CAG2dbb0r4%3DwLgw2zBMyXxSkaOXjRjCbPk-zZf6V5z5uxNyOfHQ%40mail.gmail.com.


Customise Django Models

2022-09-11 Thread Jishnu C K
Hi,

Some blogs I have written,

hope someone find it useful :)

https://jishnuck.medium.com/customizing-django-models-to-facilitate-user-restricted-data-768fe8206f82
 



Jishnu C K
jishnuc...@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/A9597799-908E-4B2E-90C2-35581EE1AACF%40gmail.com.


Re: Why I love Django

2022-09-11 Thread Paul Onteri
Thanks!

On Sunday, 11 September 2022 at 05:06:58 UTC+3 robbi...@gmail.com wrote:

> Hello Paul
>
> On 10/9/2022 9:15 pm, Paul Onteri wrote:
> > Choosing a web framework is hard. Especially now when there are a lot of 
> > frameworks on the market, each designed to address different project 
> > needs. Here is why I think that when building a large database-driven 
> > application, I would honestly pay to use Django.
> > 
> > https://paulonteri.com/thoughts/love-django 
> > 
> > 
>
> Nice blog post. I enjoy reading the content. Keep writing!
> -- 
> Regards
> Robbi Nespu
>
> PGP: D311 B5FF EEE6 0BE8 9C91 FA9E 0C81 FA30 3B3A 80BA
>

-- 
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/7d5dfc8c-e4a2-4408-9287-6620c182a6b3n%40googlegroups.com.


Does not displayed radio button in tutorial04

2022-09-11 Thread Mats
Hi, Member

I am going through the tutorial at docs.djangoproject.com." I am 
implementing a form in "Writing your first Django app, part 4" but when I 
enter the code as per the tutorial, the radio buttons on the form do not 
appear.

https://docs.djangoproject.com/en/4.1/intro/tutorial04/

I think it is because the contents of the fieldset element are not being 
rendered, but why is this happening? I am running django 4.1, latest 
version of Chrome.

The source code of the displayed page is as follows:




Whats up





return index


Mats

-- 
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/0af1422e-69f4-43b7-9cf6-6e78cd4df256n%40googlegroups.com.


Re: DJANGO ADMIN SPECIFICATION

2022-09-11 Thread chahat kaur
Yes

On Sun, Sep 11, 2022, 00:48 Dushime Mudahera Richard 
wrote:

> yeah  All u said can be done in short """CRUD
>
>
> *Best Regards *
> *Dushime Mudahera Richard*
> *Google Crowdsource Influencer*
> *GDSC Lead 2021-2022 Bugema University*
> *Visit :* https://www.facebook.com/BSA256
> *Visit me *: Community Learning MS
> 
> Web dev and  IT Manager @Bluebird Soccer Academy
> Kyangwali Refugee Settlement  Office
> richdus...@gmail.com | richarddush...@bluebirdsocceracademy.org
> *Website *: www.bluebirdsocceracademy.org
> Sports | Mentorship | Leadership | Girl Child Empowerment
>
>
> On Sat, Sep 10, 2022 at 7:21 PM nana kwame  wrote:
>
>> Please I would like to ask if Django admin can be used to update and
>> delete and create webpages also. And also if it can be used to update
>> information on the user side from the admin panel. 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/3fe4e1e6-a313-460b-aef2-77b4d76da9d5n%40googlegroups.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/CAJCm56JprYrbt9Um6HRVX%3DDVYpyjTyqBNEqTFu%3DP%3DPX3DSChYQ%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/CAN-96%3DK4Bt2Ui0iYvUVit3vp3e%3Dp-AC4JYSSdTe6BCzuHo%3DGgw%40mail.gmail.com.


Re: How to Filter Children Model In Django RestFramework

2022-09-11 Thread Abhineet Baranwal
Just use that foreign key field name with double underscore filter field
name. For example - you have a parent model ClassRoom having it's children
model Student which is referred as student fk in ClassRoom. So if you want
to filter student name from ClassRoom api then you can just write :
filterset_fields = {student__name: ["istartswith", icontaints], }

On Sun, Sep 11, 2022, 1:04 PM Renfer Richards <
personalrenfer.richa...@gmail.com> wrote:

> https://stackoverflow.com/q/73677543/1985
>
> --
> 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/10326702-a0de-49dd-9245-c41719f754b7n%40googlegroups.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/CAFOSuX%2BXcnK0GY3CBE5UgJFFoAQyq7L0uqW%2BW74YLNyMVm6SUA%40mail.gmail.com.


How to Filter Children Model In Django RestFramework

2022-09-11 Thread Renfer Richards
https://stackoverflow.com/q/73677543/1985

-- 
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/10326702-a0de-49dd-9245-c41719f754b7n%40googlegroups.com.


Re: Filter by date range

2022-09-11 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 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAM-7rO3UTB%2Bm7gYzfQ_RB%2BDnDWetnO3E18knFuLPJAU%2BBQrbLw%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/CADYG20F%3D3470-FCgJZ0amOHUDV%3DXvHQ6ZWKak2VjcB%2BjD26Qkg%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/CAFKhtoTAKxT%2BLrQ-VqXzsV-7Rm1Z%2BeAwJkQXKRJYYkVZTemd4A%40mail.gmail.com
>>