Linked Questions

Popular Questions

When a user finish to login, i'd like to redirect to another app(app_2). At the end of the url i'd like that the URL be .../app_2/username. And not .../app_2

Her's my code:

app_2/views.py

from django.shortcuts import render
# Create your views here.
def index(request,user_name)):
    return render(request,'app_2/index.html',{'user_key':user_name}) 

app_2/urls.py

from django.urls import path
from . import views

urlpatterns =[
    path('<user_name>', views.index),
]

In another app, i made a test.

app_1/views.py

if Authentification(request,username,password):
    request.session['username_key'] = username
    return redirect('/app_2/',{'key_app_1':username})

Related Questions