I am using Django and Crispy Forms. I can get the form to render correctly, but no CSS formatting appears. What do I need to do?
I have added
CRISPY_TEMPLATE_PACK = 'bootstrap'
to my settings.py
file.
The html file is as simple as it gets:
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
{% crispy form %}
{% endblock %}
What else is necessary to make it work? I understand that since the bootstrap files come bundled with crispy_forms, I don't need to copy and reference them specifically in my project's CSS path. Is this correct?
It sounds as if your django instance can't find the static
files for crispy forms. If you are running the development server, have you included 'crispy_forms'
in INSTALLED_APPS
?
If you're running a production server you'll probably need to ensure that your STATIC_FILES
paths are correct and you've run collectstatic
recently.
The authors have documented the installation process here - have you followed that completely?
Its supposed to be {{ form|crispy }}
, not {{ crispy form }}
. You are putting the form through a filter (which is what |
does in Django templates).
Also, you forgot the {% csrf_token %}
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With