path('news_detail/<slug:slug>', news_views.NewsDetailView.as_view(), name="news_detail"),
class NewsDetailView(DetailView):
model = News
slug_field = 'url_news'
context_object_name = 'news'
class News(models.Model):
url_news = models.SlugField()
{% for news in news_list %}
<a href="{% url 'news:news_detail' news.url_news %}">{{ news.title }}</a>
{% endfor %}