Answer the question
In order to leave comments, you need to log in
How can I find a bug in Django code?
I started learning Django from the book by V.A. Dronova. I ran into an error that I can't find. Namely, the link to the section is not formed. There is a function:
def by_rubric(request, rubric_id):
bbs = Bb.objects.filter(rubric=rubric_id)
rubrics = Rubric.objects.all()
current_rubric = Rubric.objects.get(pk=rubric_id)
context = {'bbs': bbs, 'rubrics': rubrics, 'current_rubric': current_rubric}
return render(request, 'bboard/by_rubric.html', context)
urlpatterns = [
path('<int:rubric_id>/', by_rubric),
path('', index),
]
Answer the question
In order to leave comments, you need to log in
{% for rubric in rubrics %}
<a href="/bboard/{{ rubrik.pk }}/">{{ rubric.name }}</a>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question