django-crispy-forms / crispy-tailwind

A Tailwind template pack for django-crispy-forms
MIT License
331 stars 56 forks source link

Set label_class or field_class on as_crispy_field #102

Open areski opened 2 years ago

areski commented 2 years ago

Hi,

I'm trying to figure out if it's possible to set the field_class when using as_crispy_field, for instance when calling the following: {{ form.field|as_crispy_field:"tailwind" }}

Reference to as_crispy_field in the code: https://github.com/django-crispy-forms/crispy-tailwind/blob/91c35473f479800e85f60b1fa4d0cf5fc0127f2c/crispy_tailwind/templatetags/tailwind_filters.py#L92

as_crispy_field is a django filter, so according to django documentation it should not be possible to pass multi arguments, which only work with template tag.

As the method as_crispy_field has those 2 arguments in the function definition, maybe I'm missing something. Any pointer would be appreciated.

SebastianDix commented 1 month ago

I think this is simply a bug, if they wanted to use multiple arguments such as in the builtin filter "yesno (https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#yesno) then they would need to split the first argument by commas for example