what is {% block content %} and {% endblock content %} for in Django?

block is used for overriding specific parts of a template.

In your case, you have a block named content and this is supposed to be overridden by children that inherit from this template.

From the examples at The Django Docs

Template to be extended, named base.html

<head>
    <link rel="stylesheet" href="https://stackoverflow.com/questions/53383602/style.css">
    <title>{% block title %}My amazing site{% endblock %}</title>
</head>

Overriding Child template

{% extends "base.html" %}

{% block title %}My amazing blog{% endblock %}

“My amazing site” will be overriden by the child and then display “My amazing blog”

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)