A filter that takes a label_tag isn't a bad solution:
@register.filter(is_safe=True)
def label_with_classes(value, arg):
return value.label_tag(attrs={'class': arg})
And then, in the template:
{{ form.my_field|label_with_classes:"class1 class2"}}
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to
django...@googlegroups.com.
> To unsubscribe from this group, send email to
django-users...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>