{% extends "admin/change_form.html" %}
{% load i18n actions static merge %}
{% block breadcrumbs %}{% if not is_popup %}
<div class="breadcrumbs">
  <a href="../../">{% trans "Home" %}</a> &rsaquo;
  <a href="../">{{ app_label|capfirst|escape }}</a> &rsaquo;
  <a href=".">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
  {{ action_short_description|capfirst }}
</div>
{% endif %}{% endblock %}
{% block content %}
{% if not transaction_supported %}
<div>Warning: your database does not support transactios. Merge cannot be validated and/or undone</div>
{% else %}

{% if adminform.form.errors %}
<ol>
  {% for error in form.errors %}
  <li><strong>{{ error|escape }}</strong></li>
  {% endfor %}
</ol>
{% endif %}
{{ adminform.form.non_field_errors }}
<form method="post">{% csrf_token %}
  {% for f in adminform.form.hidden_fields %}{{ f }}{% endfor %}
  <table>
    <tr>
      <td>{{ adminform.form.dependencies.label }}</td>
      <td>{{ adminform.form.dependencies }}</td>
    </tr>
  </table>
  <table class="mergetable" style="width:100%; overflow: hidden">
    <tr class="header">
      <th>{% trans "Field" %}</th>
      <th class="master">{% trans "Master" %} #<span id='master_pk'>{{ master.pk }}</span> ({% trans "This will be
        preserved" %})
      </th>
      <th><a class="swap" id="swap_cols" href="#">{% trans "swap" %}</a></th>
      <th class="result">{% trans "Result" %}</th>
      <th></th>
      <th class="other">{% trans "Other" %} #<span id='other_pk'>{{ other.pk }}</span> ({% trans "This will be removed" %})
      </th>
    </tr>
    {% for field in fields %}
    <tr class="{% cycle ' row1' 'row2' %} merge-row">
    <td class="column label" data-content="{{ field.name }}">{{ master|verbose_name:field.name }}</td>

    <td class="column origin master_{{ field.name }}">
      {{ formset.0|widget:field.name }}
      <p class="display">{{ master|field_display:field}}</p>
    </td>
    <td><a class="origin" id="master_{{ field.name }}" href="#"> &gt;&gt; </a></td>

    <td class="column result result_{{ field.name }}">
      {{ adminform.form|widget:field.name }}
      <p class="display" id="result_{{field.name}}"></p>
      {{ adminform.form|errors:field.name }}
    </td>

    <td><a class="other" id="other_{{ field.name }}" href="#"> &lt;&lt; </a></td>

    <td class="column other other_{{ field.name }}">
      {{ formset.1|widget:field.name }}
      <p class="display">{{ other|field_display:field }}</p>
    </td>
    </tr>
    {% endfor %}
  </table>
  <input style="margin: 5px;" type="submit" value="{% trans ' Preview' %}" name="preview">
</form>
{% endif %}
{% endblock %}
