Я новичок в django
В urls.py я установил путь следующим образом.Я пытался создать страницу с URL: localhost: 8000 / themes / 1 /
urlpatterns = [
path('topics/(?P<topic_id>\d+)/', views.topic, name='topic'),
]
В views.py.Код такой:
def topic(request, topic_id):
"""Show a single topic and all its entries"""
topic = Topic.objects.get(id=topic_id)
entries = topic.entry_set.order_by('date_added')
context = {'topic': topic, "entries": entries}
return render(request, 'learning_logs/topic.html', context)
Я получил ошибку 404 при вводе localhost: 8000 / themes / 1 /.
themes / (? P \ d +) / [name = 'topic']
Текущий путь themes / 1 / не соответствует ни одному из них.
Но правильными URL-адресами являются: localhost: 8000 / themes / (% 3FP1% 5Cd +) /
Что-то не так с путем в URL-адресах или в чем проблема?