{"id":9628,"library":"crispy-tailwind","title":"Crispy Tailwind","description":"crispy-tailwind provides a Tailwind CSS template pack for Django Crispy Forms, allowing developers to easily render forms with Tailwind's utility-first classes. It is currently at version 1.0.3 and has a moderately active release cadence, with frequent bug-fix releases and major versions adding support for newer Django and Python versions.","status":"active","version":"1.0.3","language":"en","source_language":"en","source_url":"https://github.com/django-crispy-forms/crispy-tailwind","tags":["django","forms","tailwind","crispy-forms","frontend"],"install":[{"cmd":"pip install crispy-tailwind","lang":"bash","label":"Install crispy-tailwind"}],"dependencies":[{"reason":"Required for any Django project. Version 1.0.0+ requires Django >=4.2.","package":"Django","optional":false},{"reason":"crispy-tailwind is a template pack for django-crispy-forms. Version 1.0.0+ requires django-crispy-forms >=2.0.","package":"django-crispy-forms","optional":false}],"imports":[{"note":"Used in forms.py to customize form rendering.","symbol":"FormHelper","correct":"from crispy_forms.helper import FormHelper"},{"note":"Used in forms.py to define custom form layouts.","symbol":"Layout","correct":"from crispy_forms.layout import Layout, Submit"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    # ...\n    'crispy_forms',\n    'crispy_tailwind',\n    # ...\n]\n\nCRISPY_ALLOWED_TEMPLATE_PACKS = \"tailwind\"\nCRISPY_TEMPLATE_PACK = \"tailwind\"\n\n# forms.py\nfrom django import forms\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Layout, Submit\n\nclass ContactForm(forms.Form):\n    name = forms.CharField(label='Your Name', max_length=100)\n    email = forms.EmailField(label='Your Email')\n    message = forms.CharField(label='Your Message', widget=forms.Textarea)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.helper = FormHelper()\n        self.helper.layout = Layout(\n            'name',\n            'email',\n            'message',\n            Submit('submit', 'Send', css_class='btn-primary mt-4')\n        )\n\n# template.html (e.g., in a Django view)\n# {% load crispy_forms_tags %}\n# <form method=\"post\">\n#     {% csrf_token %}\n#     {% crispy form %}\n# </form>","lang":"python","description":"After installing, add 'crispy_forms' and 'crispy_tailwind' to your `INSTALLED_APPS` in `settings.py`. Crucially, set `CRISPY_ALLOWED_TEMPLATE_PACKS = \"tailwind\"` and `CRISPY_TEMPLATE_PACK = \"tailwind\"`. Then, in your Django forms, instantiate a `FormHelper` and define your layout. Finally, render the form in your template using `{% load crispy_forms_tags %}` and `{% crispy form %}`."},"warnings":[{"fix":"Upgrade your Django project to Django >=4.2 and Python >=3.8. Also, ensure `django-crispy-forms` is at least version 2.0.0. Review the release notes for `crispy-tailwind 1.0.0` for full details.","message":"Crispy-tailwind 1.0.0 introduced significant breaking changes, dropping support for older Django and Python versions and requiring an updated `django-crispy-forms`.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Ensure `INSTALLED_APPS` in `settings.py` is configured as: `['crispy_forms', 'crispy_tailwind', ...]`. The order matters for template loading.","message":"The `crispy_tailwind` application must be listed in `INSTALLED_APPS` *after* `crispy_forms` to ensure its templates correctly override the base ones.","severity":"gotcha","affected_versions":"All"},{"fix":"Refer to the official Tailwind CSS documentation and your Django project's setup guide to correctly integrate and build Tailwind CSS (e.g., via PostCSS, CDN, or Tailwind CLI) for your frontend.","message":"crispy-tailwind only provides the HTML structure with Tailwind CSS classes; it does not include or manage the Tailwind CSS framework itself. Your Django project must still be set up to compile and serve Tailwind CSS.","severity":"gotcha","affected_versions":"All"},{"fix":"In your `settings.py`, ensure you have both `CRISPY_ALLOWED_TEMPLATE_PACKS = \"tailwind\"` and `CRISPY_TEMPLATE_PACK = \"tailwind\"` defined.","message":"Forgetting to set `CRISPY_TEMPLATE_PACK = \"tailwind\"` or setting `CRISPY_ALLOWED_TEMPLATE_PACKS` incorrectly will result in forms rendering with default (usually Bootstrap-like) styles or template errors.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Add `CRISPY_ALLOWED_TEMPLATE_PACKS = \"tailwind\"` to `settings.py`. Also, ensure `crispy_tailwind` is included in `INSTALLED_APPS` (after `crispy_forms`).","cause":"The `CRISPY_ALLOWED_TEMPLATE_PACKS` setting is missing or does not include 'tailwind', or `crispy_tailwind` is not in `INSTALLED_APPS`.","error":"ImproperlyConfigured: 'tailwind' isn't an allowed template pack."},{"fix":"Verify that both `crispy_forms` and `crispy_tailwind` are in your `INSTALLED_APPS` in `settings.py` (in that order), and that `CRISPY_TEMPLATE_PACK = \"tailwind\"` is correctly set.","cause":"Django Crispy Forms is looking for its default template pack's files, indicating crispy-tailwind's templates are not being found or recognized.","error":"TemplateDoesNotExist at /my-form/ crispy_forms/whole_uni_form.html"},{"fix":"Ensure `CRISPY_TEMPLATE_PACK = \"tailwind\"` is set in `settings.py`. Crucially, confirm that Tailwind CSS is properly built, included, and available in your frontend assets for your Django templates.","cause":"This usually means the Tailwind CSS framework itself is not correctly integrated into your Django project, or the `CRISPY_TEMPLATE_PACK` is not correctly set to 'tailwind'.","error":"Forms render without Tailwind styles (plain HTML)."},{"fix":"Add `from crispy_forms.helper import FormHelper` to the top of your `forms.py` file where `FormHelper` is used.","cause":"`FormHelper` class was used in a `forms.py` file without being imported.","error":"NameError: name 'FormHelper' is not defined"}]}