template tag to get form field value

1
2
3
4
5
6
7
from django import template
register = template.Library()

@register.simple_tag
def field_value(field):
    """ returns field value """
    return field.form.initial.get(field.name, '')

More like this

  1. Inspect object debugging tag by dballanc 5 years, 11 months ago
  2. Comparing two json like python objects by nmb10 2 years, 7 months ago
  3. render_as_template template tag by cogat 4 years, 3 months ago
  4. email_links by sansmojo 6 years ago
  5. Support for {% macro %} tags in templates, version 2 by mludvig 5 years, 10 months ago

Comments

(Forgotten your password?)