66👍
As of django-crispy-forms 2.0 the template packs are now in separate packages.
You will need to pip install crispy-bootstrap4
and add crispy_bootstrap4
to your list of INSTALLED_APPS
.
15👍
if you need to use bootstrap4
- pip install django-crispy-forms
- pip install crispy-bootstrap4
inside settings.py in the main app add
INSTALLED_APPS = [ ... 'crispy_forms', 'crispy_bootstrap4', ... ]
and CRISPY_TEMPLATE_PACK = 'bootstrap4'
inside your_html.html file add
{% load crispy_forms_tags %}
and you can use cripy_forms as you like
- [Django]-Curious about get_form_kwargs in FormView
- [Django]-Setting Django up to use MySQL
- [Django]-What base_name parameter do I need in my route to make this Django API work?
1👍
-
Run this command:
pip install django-crispy-forms
-
Go to settings.py and add this in the installed apps (don’t forget the comma):
"crispy_forms", "crispy_bootstrap4"
-
Add this after the installed apps (here there’s no need for a comma):
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap4" CRISPY_TEMPLATE_PACK = 'bootstrap4'
-
Go to the html page where you want to add the crispy form and add this in the head section:
{% load crispy_forms_tags %}
-
Finally add this to the body section:
{{form|crispy_field}}
- [Django]-How to auto insert the current user when creating an object in django admin?
- [Django]-Django: a class based view with mixins and dispatch method
- [Django]-Django CMS fails to synch db or migrate
0👍
I faced same issue and got solution. This is because you are using django-crispy-forms==2.0 and your project is not compatible with this version. also this django-crispy-forms==2.0 not support bootstrap4.
SOLUTION:
so install packages with below mention version:
(make sure python version > 3.7)
- pip3 install Django==4.1.6
- pip3 install django-allauth==0.52.0
- pip3 install django-crispy-forms==1.14.0 # version <=1.70
- pip3 install django-embed-video
- [Django]-How to query abstract-class-based objects in Django?
- [Django]-Cannot import models from another app in Django
- [Django]-Django's SuspiciousOperation Invalid HTTP_HOST header