Template Filter attr

1
2
3
4
5
6
7
8
9
from django import template

register = template.Library()

@register.filter_function
def attr(obj, arg1):
    att, value = arg1.split("=")
    obj.field.widget.attrs[att] = value
    return obj

More like this

  1. Custom CSS class in Form with template tag filter by kegan 4 years, 10 months ago
  2. Advanced Search in django admin by visik7 3 years, 3 months ago
  3. Honeypot Field by SmileyChris 7 years ago
  4. Form row filter by kylefox 6 years, 2 months ago
  5. order_by template filter by marinho 5 years, 11 months ago

Comments

(Forgotten your password?)