Answer the question
In order to leave comments, you need to log in
Why doesn't Django find the right url?
Reverse for 'review' with arguments '('article.id',)' not found. 1 pattern(s) tried: ['article\\/\\$']
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>News</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body>
{% for article in articles %}
<div class="card w-75">
<div class="card-body">
<h5 class="card-title"><a href="{% url 'review' 'article.id'%}">{{ article.title }}</a></h5>
<p class="card-text">{{ article.prev }}...</p>
<p class="card-text"><small class="text-muted">{{ article.published_date }}</small></p>
<a href="#" class="btn btn-primary">Опубликовать</a>
<a href="#" class="btn btn-primary">Удалить</a>
<a href="#" class="btn btn-primary">Изменить</a>
</div>
</div>
{% endfor %}
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>
urls
<code lang="python">
path('article/<int:id/>', views.view_article, name='review')
</code>
views
<code lang="python">
def view_article(request, art_id):
article = Article.objects.filter(id=art_id)
return render(request, 'view_article.html', context={'article': article})
</code>
Подскажите, пожалуйста, почему не находит?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question