help on autologging users after signup

62 views
Skip to first unread message

ola neat

unread,
May 22, 2021, 9:57:51 PM5/22/21
to django...@googlegroups.com
halo guys, i wan  make it possible for user to auto login user after signup in my app using drf
but still getting null as d user-id & returning anonymous user err
can anyone help out
image.png
image.png

lalit suthar

unread,
May 24, 2021, 12:21:14 AM5/24/21
to Django users
in authenticate function take values from request.data dictionary
email = request.data.get('email')
poassword = request.data.get('password')

ola neat

unread,
May 24, 2021, 2:29:33 AM5/24/21
to django...@googlegroups.com

I've tried that it didn't wrk

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a3a45860-b65c-45f0-9c24-cd23165e5048n%40googlegroups.com.

I,M& M

unread,
May 24, 2021, 4:09:17 PM5/24/21
to Django users
in drf, the request.POST dictionary does not contain the body of the request instead use the request.data to access the requests body.
ex.
email = request.data.get('email')
password= request.data.get('password')
new_user = authenticate(request, email, password)
request.data contains the username and password

On Monday, May 24, 2021 at 9:29:33 AM UTC+3 tosina...@gmail.com wrote:

I've tried that it didn't wrk

On 24 May 2021 05:21, "lalit suthar" <sutharl...@gmail.com> wrote:
in authenticate function take values from request.data dictionary
email = request.data.get('email')
poassword = request.data.get('password')
On Sunday, 23 May 2021 at 07:27:51 UTC+5:30 tosina...@gmail.com wrote:
halo guys, i wan  make it possible for user to auto login user after signup in my app using drf
but still getting null as d user-id & returning anonymous user err
can anyone help out
image.png
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...@googlegroups.com.

ola neat

unread,
May 25, 2021, 2:45:57 AM5/25/21
to django...@googlegroups.com
image.png
image.png


so this is it, i've tried it, but still returning id of null
and it not returning the login success msg

lalit suthar

unread,
May 26, 2021, 1:02:38 AM5/26/21
to Django users
It is not returning the "login success" message because you are using `APIView` parent class and that does not have create() method so your code inside create() won't get executed. You have to move that code to post() method. https://www.cdrf.co/ is a good reference to find out different Parent class's and their supported methods.

AK channel

unread,
May 26, 2021, 4:43:30 PM5/26/21
to django...@googlegroups.com
Hello guys,
I am new to django, can anyone tell me if I want to add two databases with Django specific app in a single project, how can I do it.

for example I have two apps like USER and PRODUCTS so I want to join with a separate database for both of them

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages