from contextlib import suppress

from django import template

register = template.Library()


@register.filter
def get_field(form, field_name):
    with suppress(KeyError):
        return form[field_name]
