D
D
Daria2020-03-04 17:19:50
Django
Daria, 2020-03-04 17:19:50

Can you help me understand inheritance in Django?

Just read the tutorials on django girls and started reading the documentation. Confused with template inheritance!

through views.py I render base.html

def blog(request):
 
    return render(request, 'base.html', context={})

base.html
<body>
    {% block contant %}
      Место для постов
    {% endblock contant %}
</body>

should inherit posts from posts.html
{% extends "base.html" %}

{% block contant %}
    Сами посты
{% endblock contant %}
, but there is no inheritance. Complete project

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dimastbk, 2020-03-04
@Sestokova

On the contrary: you need to render posts.html, and base.html will be pulled up through extends.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question