Переход на домашнюю страницу по умолчанию в django
Привет всем друзьям, я разработчик Django и я хочу перейти к определенному url с slug, но когда я пытаюсь это сделать, сервер автоматически переходит на домашнюю страницу, я не знаю, что мне делать.
views.py
def ChangeQuizInfol(request,slugp):
print("changequizinfo is running.")
if request.method == 'POST':
print("is post.")
form = NewAzmoonForms()
# else:
# form = NewAzmoonForms(request.POST, instance=quiz)
# if form.is_valid():
# form.save()
else:
quiz = QuizStudent.objects.get(slug=slugp)
print(quiz)
questions = Questions.objects.filter(quiz_id=quiz.id)
print(questions)
try:
try:
co = {
"quiz":quiz,
"form":form,
"questions":questions
}
except:
co = {
"form":form,
}
except:
co = {
}
return render(request, "komaki/per.html", co)
def ListsTeacherQuizes(request):
print("list is running.")
user = request.user
quizes = QuizStudent.objects.filter(author_id = user.id)
return render(request, "komaki/lists.html",{"quizes":quizes})
urls.py
from django.urls import path
from . import views
app_name = 'komaki'
urlpatterns = [
path('',views.avaL,name='avaL'),
path('create/',views.create_question,name='create_question'),
path('start/',views.startazmoon,name='startazmoon'),
path('azm/',views.azmoonpage,name='azmoonpage'),
path('Sokht/',views.NeveshtanAzmoon,name='NeveshtanAzmoon'),
path("NeveshtanQuestion/",views.NeveshtanQuestion,name='NeveshtanQuestion'),
path('ShowQuizStudents/',views.ShowQuizes,name='ShowQuizes'),
path('<slug>',views.EachQuiz,name='EachQuiz'),
path("equation/", views.Equation, name='Equation'),
path("geo/",views.Geo, name='Geo'),
path("Chang/", views.Chang, name='Chang'),
path("AskAndAnswer/",views.AskAndAnswer, name="AskAndAnswer"),
path("Pish/",views.Pishrafteh, name="Pishrafteh"),
path("UploadVideo/",views.Videoupload,name="Videoupload"),
path("Lists/",views.ListsTeacherQuizes, name="ListsTeacherQuizes"),
path("<slugp>", views.ChangeQuizInfol, name="ChangeQuizInfol"),
]
lists.html
{% extends 'base.html' %}
{% block head %}
{% endblock %}
{% block body %}
{% for quiz in quizes %}
<div class="quiz{{ quiz.id }}" style="margin-top: 100px;">
<a href="{% url "komaki:ChangeQuizInfol" slugp=quiz.correct_slug %}">{{quiz.name}}</a>
</div>
{% endfor %}
{% endblock %}
per.html
{% extends "base.html" %}
{% load static %}
{% block head %}{% endblock head %}
{% block body %}
<h2>{{quiz.name}}</h2>
{% endblock body %}
Не переходит на этот конкретный url, вместо этого переходит на домашнюю страницу. Спасибо за помощь.