Milo.D
Milo.D

Reputation: 365

Invalid block tag - bootstrap-form, expected endblock

I am working on a django project, but for some reason the template I am using brings up an invalid block tag error. I have looked at some other similar questions, but nothing seems helpful, so if you can see the problem please do tell me.Here is the template:

{% extends "learning_logs/base.html" %}
{% load bootstrap3 %}

{% block header %}
    <h2>Register an account.</h2>
{% endblock header %} 

{% block content %}

    <form method="post" action="{% url 'users:register' %}" class="form">
        {% csrf_token %}
        {% bootstrap-form form %}

        {% buttons %}
            <button name="sumbit" class="btn btn-primary">register</button>
        {% endbuttons %}

        <input type="hidden" name="next" value="{% url 'learning_logs:index' %}" />
    </form>

{% endblock content %}  

Thanks,
Milo

Upvotes: 4

Views: 4057

Answers (3)

Dhia Eddine Benterki
Dhia Eddine Benterki

Reputation: 11

Also for everyone else that have this same error and it's not a typo like OP did, make sure you have loaded bootstrap in your child template via

{% extends "base.html" %}
{% load bootstrapX %}

Where X is your version of bootstrap , So it's not sufficent to load it in the base template.In addition to that make sure the load bootstrap statment is after the extends statment, This video explains the setup in great detail https://www.youtube.com/watch?v=YmJ0TACm8oE

Upvotes: 1

Amarpreet Singh
Amarpreet Singh

Reputation: 2260

{% bootstrap-form form %} should be {% bootstrap_form form %}. Also paste the error

Upvotes: 1

nik_m
nik_m

Reputation: 12086

Found it. It's {% bootstrap_form form %}, not {% bootstrap-form form %}

Check it here

Upvotes: 2

Related Questions