New to django
Im completely confused. Do i use
Crispy-bootstrap5
Or
Django-bootstrap5
And or
Crispy-forms
Or
Django-crispy-forms
Omg! What a mess. Everywhere i look confusion.
Someone please shed some huge light on this…please.
New to django
Im completely confused. Do i use
Crispy-bootstrap5
Or
Django-bootstrap5
And or
Crispy-forms
Or
Django-crispy-forms
Omg! What a mess. Everywhere i look confusion.
Someone please shed some huge light on this…please.
Briefly, Crispy provides a way of formatting forms with options not generally available in base Django. (I love it and use it extensively.) The module is named “crispy_forms”, but the package as it is stored on pypi.org is “django-crispy-forms”. It’s one package referred by different names in different contexts.
The crispy-bootstrap5 package is (primarily) a set of templates designed to apply bootstrap5 classes to widgets being rendered by crispy.
While I am not specifically familiar with the django-bootstrap5, I’m going to guess it’s similar in principle in that it’s a set of templates for rendering different built-in components using bootstrap5 class names.
Thank you so much for the information. May I ask what templates package you are using with crispy forms and how you reference it in settings.py ?
Thank you
John
I use Django-bootstrap5 and can recommend it. I looked briefly at crispy and found it too complex in comparison. If you’re already using bootstrap, you probably don’t need the flexibility (and complexity) that comes with it, because bootstrap forms are designed with strict layouts so the CSS is applied.
In edge cases when I want some special complexity, I use the widget-tweaks package and bare Django to complement Django-bootstrap5.
We rely heavily upon Crispy - we find it to be amazingly flexible and the power provided by the Layout
objects works exceeding well for us.
Most of our projects are still using bootstrap4, but as far as the configuration is concerned, there’s no difference between the two. (There are some differences, so moving from 4 → 5 is not a simple drop-in replacement.)
Anyway, looking at one of our projects, the crispy-related configurations appear here:
INSTALLED_APPS = [
...
'crispy_bootstrap4',
'crispy_forms',
...
]
CRISPY_TEMPLATE_PACK = 'bootstrap4'
Then a pip list
includes:
crispy-bootstrap4 2022.1
django-crispy-forms 2.0
Hi Ken,
Yes happy to see I have my config set up the same way as yours except I’m starting a new project so I’m trying bootstrap5.
Settings.py
‘crispy_forms’,
‘crispy_bootstrap5’,
‘django_bootstrap5’,
]
CRISPY_TEMPLATE_PACK = ‘bootstrap5’
CRISPY_ALLOWED_TEMPLATE_PACK = ‘bootstrap5’
not sure where I got this last entry above? But I threw it in.