Closed Minras closed 1 year ago
Hi @Minras. I am trying crispy forms for the first time, and I found this issue.
I just made it work for a simple form for comments in a blog so I will leave down here what I did in case useful:
My env has, amongst other stuff, the same packages installed as yours
Django==4.2.2
crispy-bootstrap4==2022.1
django-crispy-forms==2.0
My python version is Python 3.11.4
in settings.py (or base.py) I got:
INSTALLED_APPS = [
# all my other apps up here...
"crispy_forms",
"crispy_bootstrap4",
]
# more settings in the middle here...
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap4"
CRISPY_TEMPLATE_PACK = "bootstrap4"
and in my template I got:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
{% load crispy_forms_tags %}
<!-- more code in the middle.. -->
<h4 class="card-title card-title-dash mb-4">Add a comment</h4>
<form method="POST">
{% csrf_token %}
<div class="form-group">
{{comment_form|crispy}}
<button type="submit" class="btn btn-success">Add comment <i class="fas fa-comments"></i></button>
</div>
</form>
Again, not an expert here, but I hope this comment is useful in some way
Regards!
Please have a look at https://github.com/django-crispy-forms/django-crispy-forms/issues/377. In particular this comment.
This seems to me like a project config issue rather than an issue with crispy_bootstrap4
as such. Happy to accept PRs to improve clarity to docs if that would help.
When adding
"crispy_bootstrap4",
toINSTALLED_APPS
, Django fails with the following error:To localize the problem, I tried to create a new project and add only crispy forms there, and the problem still exists. Environment:
Python version:
3.11.3