Как я могу заменить часть url при перенаправлении?

У меня есть некоторые проблемы с перенаправлением урлов в моем приложении Django.

Это мой urls.py:

urlpatterns = [
path('Stu_SignUp/step1/', views.new_student, name='new_student'),
path('Stu_SignUp/step2/', views.comPnew_student, name='comPnew_student')]

Теперь я хочу изменить часть url с /step1/ на /step2/.

Вот мое приложение views.py:

def new_student(request):
if request.method == "POST":
    Person.objects.create(p_fName=request.POST['fName'], p_lName=request.POST['lName'], p_SSN=request.POST['SSN'],
                          p_birthDate=request.POST['birthdate'], p_phoneNum=request.POST['phoneNum'])
    return redirect('Stu_SignUp/step2/')
else:
    return render(request, 'signUp_student.html', context={'person': Person})


def comPnew_student(request):
    if request.method == "POST":
        if request.method['password'] == request.method['conf_Pass']:
            update_person = Person.objects.get(Person_ID=Person.objects.last().id)
            update_person.p_Email = request.POST['email']
            update_person.p_Password = request.POST['password']
            return redirect('Stu_SignUp/step2/')
    else:
        return render(request, 'signUp_student2.html', context={'person': Person})

Html Шаблон signUp_student.html и signUp_student2.html:

Номер страницы 1:

    <form action="{%  url 'new_student' %}" method="post">
    {% csrf_token %}
    <label for="firstName">First Name<br>
        <input type="text" name="fName">
    </label><br>
    <label for="lastName">Last Name<br>
        <input type="text" name="lName">
    </label><br>
    <label for="firstName">SSN Code<br>
        <input type="text" name="SSN">
    </label><br>
    <label for="birthdate">Birthdate <br>
        <input type="date" name='birthdate'>
    </label><br>
    <label for="phoneNumber">Phone Number<br>
        <input type="text" name='phoneNum'>
    </label>
    <br><br>
    <button type="submit">Sign up</button>
</form>

Страница номер 2:

    <form action="{%  url 'comPnew_student' %}" method="post">
    {% csrf_token %}
    <label for="Email">Email<br>
        <input type="text" name="email">
    </label><br>
    <label for="password">Password<br>
        <input type="text" name="password">
    </label><br>
    <label for="confPassword">Confirm Password<br>
        <input type="text" name="conf_Pass">
    </label><br>
    <br><br>
    <button type="submit">Sign up</button>
</form>

Буду благодарен за помощь.

добавьте косую черту перед путем перенаправления, redirect('/Stu_SignUp/step2/')

Спасибо Марат

вы можете добавить косую черту перед путем return redirect('/Stu_SignUp/step2/')

ИЛИ

используйте HttpResponseRedirect

from django.http import HttpResponseRedirect

return HttpResponseRedirect("http://Stu_SignUp/step2/")
Вернуться на верх