官方文档地址:https://django-bootstrap.readthedocs.io/en/latest/installation.html
    要注意的是,如果引用了base.html,那么同时也会继承base里面的
    {% block bootstrap4_content %},如果想使用bootstrap4_content 的话。
    css等就不用重新load了,直接再base中引用就ok。

    1. <!-- jobs/templates/base.html-->
    2. {% load bootstrap4 %}
    3. {% bootstrap_css %}
    4. {% bootstrap_javascript jquery='full' %}
    5. {% bootstrap_messages %}
    6. <h1 style="margin:auto; width:50%"> 小叮当的主页啦 </h1>
    7. <p></p>
    8. {% block header %}
    9. <a href="/" style="text-decoration: none; color:#007bff">首页</a>
    10. <a href="/joblist" style="text-decoration: none; color:#007bff">职位列表</a>
    11. {% if user.is_authenticated %}
    12. <a href="/accounts/logout" style="text-decoration: none; color:#007bff">退出</a>
    13. {% else %}
    14. <a href="/accounts/login" style="text-decoration: none; color:#007bff">登录</a>
    15. {% endif %}
    16. {% if user.is_authenticated %}
    17. <p>欢迎 {{user.username}}</p>
    18. {% else %}
    19. <p>欢迎游客,请去登录哦!</p>
    20. {% endif %}
    21. {% endblock %}
    22. <hr>
    23. {% block bootstrap4_content %}
    24. {% endblock %}
    1. {% extends 'base.html'%}
    2. {% load bootstrap4 %}
    3. {% block bootstrap4_content %}
    4. <h2>提交简历</h2>
    5. <form method="post" class="form" style="width:300px; margin-left:5px">
    6. {% csrf_token %}
    7. {% bootstrap_form form %}
    8. {% buttons %}
    9. <button type="submit" class="btn btn-primary">提交</button>
    10. {% endbuttons %}
    11. </form>
    12. {% endblock %}