Search code examples
pythondjangomaterial-designdjango-formwizardmaterialize

Django formwizard breaks after adding css style django-material


I have my Django project using a base template for rendering the views as in the following paste http://pastebin.com/uUZT40ge called from root as base.html , and django-material https://pypi.python.org/pypi/django-material providing the style and layout for the form elements.With a simple for such as below it works ok:

    {% extends "base.html" %}
{% load i18n material_form %}
{% block content %}
<form  action="" method="post">
    {% csrf_token %}
    {% form form=form %}{% endform %}
    <input type="submit" value="Proceed" />
</form>
{% endblock %}

however when using the same base template with formwizard to render a set of three forms .The first is displayed with proper layout and style but on submit does not proceed to the next step.

    {% extends "base.html" %}
{% load material_form %}
{% block content %}
<form  action="" method="post">
    {% csrf_token %}
    {{ wizard.management_form }}
    {% if wizard.form.forms %}
        {{ wizard.form.management_form }}
            {% for form in wizard.form.forms %}
                {% form form=form %}{% endform %}
            {% endfor %}
    {% else %}
        {{ wizard.form }}
    {% endif %}
    <input type="submit" value="Proceed" />
</form>
{% endblock %}

Django is version 1.8 on OSX10.10


Solution

  • changing the form template to below fixes the issue:

    <form  action="" method="post">
    {% csrf_token %}
    {{ wizard.management_form }}
    {% if wizard.form.forms %}
        {{ wizard.form.management_form }}
            {% for form in wizard.form.forms %}
                {% form %}{% endform %}
            {% endfor %}
    {% else %}
        {% form form=wizard.form %}{% endform %}
    {% endif %}
    <input