from django import template
register = template.Library()

@register.simple_tag
def get_verbose_field_name(instance, field_name):
    return instance._meta.get_field(field_name).verbose_name.title()


@register.simple_tag
def product_property(product, prop_name):
    for p in product.prdprops_set.all():
        if p.prd_property.categoryprop.name == prop_name:
            return p.prd_property.value
    return ''
