From 5bd98ff51f254064b5779e8163a192625a78fb4d Mon Sep 17 00:00:00 2001 From: areski Date: Mon, 19 Apr 2021 14:19:07 +0200 Subject: [PATCH 1/2] [fix](field) change crispy_field to tailwind_field --- .../templates/tailwind/layout/field_with_buttons.html | 2 +- crispy_tailwind/templates/tailwind/layout/inline_field.html | 4 ++-- crispy_tailwind/templatetags/tailwind_field.py | 4 ++-- crispy_tailwind/templatetags/tailwind_filters.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crispy_tailwind/templates/tailwind/layout/field_with_buttons.html b/crispy_tailwind/templates/tailwind/layout/field_with_buttons.html index e4d0631..7653448 100644 --- a/crispy_tailwind/templates/tailwind/layout/field_with_buttons.html +++ b/crispy_tailwind/templates/tailwind/layout/field_with_buttons.html @@ -9,7 +9,7 @@
- {% crispy_field field %} + {% tailwind_field field %} {{ buttons|safe }}
{% include 'tailwind/layout/help_text_and_errors.html' %} diff --git a/crispy_tailwind/templates/tailwind/layout/inline_field.html b/crispy_tailwind/templates/tailwind/layout/inline_field.html index 3b2d55a..6760251 100644 --- a/crispy_tailwind/templates/tailwind/layout/inline_field.html +++ b/crispy_tailwind/templates/tailwind/layout/inline_field.html @@ -6,7 +6,7 @@ {% if field|is_checkbox %}
@@ -15,7 +15,7 @@ - {% crispy_field field 'placeholder' field.label %} + {% tailwind_field field 'placeholder' field.label %}
{% endif %} {% endif %} diff --git a/crispy_tailwind/templatetags/tailwind_field.py b/crispy_tailwind/templatetags/tailwind_field.py index 4c1dd4d..ee75647 100644 --- a/crispy_tailwind/templatetags/tailwind_field.py +++ b/crispy_tailwind/templatetags/tailwind_field.py @@ -188,9 +188,9 @@ def render(self, context): # noqa: C901 @register.tag(name="tailwind_field") -def crispy_field(parser, token): +def tailwind_field(parser, token): """ - {% crispy_field field attrs %} + {% tailwind_field field attrs %} """ token = token.split_contents() field = token.pop(1) diff --git a/crispy_tailwind/templatetags/tailwind_filters.py b/crispy_tailwind/templatetags/tailwind_filters.py index 1f15283..4412b85 100644 --- a/crispy_tailwind/templatetags/tailwind_filters.py +++ b/crispy_tailwind/templatetags/tailwind_filters.py @@ -98,7 +98,7 @@ def as_crispy_field(field, template_pack=TEMPLATE_PACK, label_class="", field_cl or:: - {{ form.field|as_crispy_field:"bootstrap" }} + {{ form.field|as_crispy_field:"tailwind" }} """ if not isinstance(field, boundfield.BoundField) and settings.DEBUG: raise CrispyError("|as_crispy_field got passed an invalid or inexistent field") From dae5f48313f847ce4fb01c487a7c29eb3aa7f8d7 Mon Sep 17 00:00:00 2001 From: areski Date: Fri, 17 Sep 2021 12:48:08 +0200 Subject: [PATCH 2/2] [fix] add support for dark mode --- crispy_tailwind/templates/tailwind/field.html | 2 +- .../layout/checkboxselectmultiple_inline.html | 2 +- .../templates/tailwind/layout/help_text.html | 4 +- .../layout/prepended_appended_text.html | 2 +- .../tailwind/layout/radioselect_inline.html | 2 +- .../templatetags/tailwind_filters.py | 2 +- tests/test_crispy_addon.py | 2 +- tests/test_filter.py | 22 ++++---- tests/test_helper.py | 52 +++++++++---------- tests/test_prepended_appended.py | 10 ++-- tests/test_table_inline_formset.py | 4 +- 11 files changed, 52 insertions(+), 52 deletions(-) diff --git a/crispy_tailwind/templates/tailwind/field.html b/crispy_tailwind/templates/tailwind/field.html index 0347a0f..9a284bb 100644 --- a/crispy_tailwind/templates/tailwind/field.html +++ b/crispy_tailwind/templates/tailwind/field.html @@ -7,7 +7,7 @@ <{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="{% if wrapper_class %}{{ wrapper_class }} {% endif %}{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}"> {% if field.label and form_show_labels %} -