A
A
altertable2020-05-19 16:16:44
Django
altertable, 2020-05-19 16:16:44

Django how to follow a slug link???

URLs

path('news_detail/<slug:url_news>', news_views.NewsDetail.as_view(), name="news_detail"),


views
class NewsDetail(View):
    def get(self, request, url_news):
        context = {}
        return render(request, 'news_template/news_detail.html', context)


{% for news in news_list %}
        <div class="card  bg-light mb-3 d-inline-block">
            <div class="card-body">
            ############################ ошибка в следующей строке, не могу понять в чем????
            <h4 class="card-title"><a class="" href="{% url 'news:news_detail' news.url %}">{{ news.title }}</a></h4>
              <p class="card-text">
                {{ news.short_describe }}
              </p>
              <a href="#!" class="card-link ">Докладніше</a>
            </div>
          </div>


5ec3dc17500b1383963776.png
5ec3dc399c7aa854795515.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
altertable, 2020-05-19
@vityareabko

Found an error!
5ec3e9d57e320658928927.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question