{% load i18n %}
{% load l10n %}

{% if record.direction == "in" %}
  {{ record.foreign_network }}
  [{% for v in record.foreign_network.vlans.all %}
    {{ v.name }}{% if not forloop.last %},{% endif %}
  {% endfor %}]
{% else %}
  {% if record.r_type == "host" %}
    {{ record.host.get_fqdn }}
  {% else %}
    {{ record.r_type }}
  {% endif %}
{% endif %}

<i class="fa fa-arrow-right"></i>

{% if record.direction == "out" %}
  {{ record.foreign_network }}
{% else %}
  {% if record.r_type == "host" %}
    {{ record.host.get_fqdn }}
  {% else %}
    {{ record.r_type }}
  {% endif %}
{% endif %}
{% if record.accept %}
<span class="label label-info" style="margin-left: 5px;">ACCEPT</span>
{% endif %}

{% if record.extra %}
  <span class="label label-default">{{ record.extra }}</span>
{% endif %}

{% if record.nat %}
  <span class="label label-success">NAT
      [
        {{record.nat_external_port}}
        <i class="fa fa-arrow-right"></i>
        {{ record.dport }}
      ]
      {{ record.proto|upper }}
  </span>
{% endif %}
