{% load custom_tags_and_filters %}
{% if rate_type.category_specific and rate_categories %}
{% for category in rate_categories %}
{{ rate_type }} ({{ category }})
{% with type_name=rate_type.get_type_form_name|add:'_'|add:category.name|lower %}
{% with rate_form=forms|get_item:type_name %}
{% if rate_form.instance.id %}{% endif %}
{% if rate_form.amount.errors %}
{{ rate_form.amount.errors|striptags }}
{% endif %}
{% if rate_form.flat.errors %}
{{ rate_form.flat.errors|striptags }}
{% endif %}
{% if rate_form.minimum_charge.errors %}
{{ rate_form.minimum_charge.errors|striptags }}
{% endif %}
{% endwith %}
{% endwith %}
{% endfor %}
{% else %}
{# this is the exact copy of the previous html, but with a different rate_form name #}
{{ rate_type }}
{% with type_name=rate_type.get_type_form_name %}
{% with rate_form=forms|get_item:type_name %}
{% if rate_form.instance.id %}{% endif %}