from django import template

register = template.Library()

@register.filter
def daisyui(field):
    """Add DaisyUI classes to form fields."""
    widget = field.field.widget
    from django import forms
    if isinstance(widget, forms.Select):
        field.field.widget.attrs['class'] = 'select select-bordered w-full'
    elif isinstance(widget, forms.Textarea):
        field.field.widget.attrs['class'] = 'textarea textarea-bordered w-full'
    elif isinstance(widget, forms.CheckboxInput):
        field.field.widget.attrs['class'] = 'checkbox'
    else:
        field.field.widget.attrs['class'] = 'input input-bordered w-full'
    return field