Z
Z
zkweb2016-05-12 13:37:41
Django
zkweb, 2016-05-12 13:37:41

How to make breadcrumbs like in the admin panel?

I'm new to Django!
How to make breadcrumbs in django cbv similar to those in the admin panel?
THX

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Aksenov, 2016-05-12
@hellmin

you can do so. In base.html, write a block for breadcrumbs.

{% block breadcrumbs %}
    <div class="breadcrumb"><a href="/">Главная</a></div>
{% endblock %}

For example, there is a Catalog of Articles and a separate view of the Article. And the templates for them are articles.html and article.html
articles.html
{% extends 'base.html' %}

{% block breadcrumbs %}
    {{ block.super }}
    <div class="breadcrumb"><a href="{% url 'articles:articles' %}">Каталог статей</a></div>
{% endblock %}

article.html
{% extends 'articles.html' %}

{% block breadcrumbs %}
    {{ block.super }}
    <div class="breadcrumb"><a href="{% url 'articles:article_view' article_id=article.id %}">{{ article.title }}</a></div>
{% endblock %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question