Redirect

19 views
Skip to first unread message

Soumen Khatua

unread,
May 14, 2019, 7:47:48 AM5/14/19
to django...@googlegroups.com
Hi Folks,
Actually after login I want to redirect them by their name to a custome page. 

Assume  my name is soumen so my url will be after login:
But not every time only they will click on particular login button.


Please help me.
Thank you.

Regards.
Soumen



Andréas Kühne

unread,
May 14, 2019, 9:31:12 AM5/14/19
to django...@googlegroups.com
Hi,

You need to add a specific view for that button - so that login form has a specific action that does the login and redirects to that url. That's all you need to do.

Regards,

Andréas


--
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.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WYieo85n0HZjUSOASEarcRm-MkzTkAJ0kUKDvWWYAkoAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Victor H. Velasquez Rizo

unread,
May 14, 2019, 7:51:21 PM5/14/19
to django...@googlegroups.com
Hi Soumen.

your are trying to re-direct an user to a customized url. To do that you need to create an URL that receive the name as an argument.

urls.py
path('url/<user_name>', view, name='view_name'),

View.py
from django.shortcuts import redirect

return redirect('app:view_name', user_name=userName)



Soumen Khatua

unread,
May 14, 2019, 8:56:21 PM5/14/19
to django...@googlegroups.com
Thanks for your help. But it should be redirect to these custom page if and only if  I'll click login button and at the same time it should not redirect to custom page if it is coming by loginrequired functionality.

Can you share me the code, please if it is possible. 

Thank you once again. 



--
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.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Victor H. Velasquez Rizo

unread,
May 14, 2019, 9:10:34 PM5/14/19
to django...@googlegroups.com
What I sent was just assuming that the user already meet the requirements youn describe.

Share the code that you have so far and we can work base on it.!



For more options, visit https://groups.google.com/d/optout.


--



Atte...,.
Vìctor Hugo Velàsquez Rizo
Cali - Colombia
Reply all
Reply to author
Forward
0 new messages