classification_value_tree.html 1.11 KB
{% load dictionary_extras %}
<ul class="value-tree">
    {% for value, subtree in value_tree %}
        <li>
      <span class="value-name">
        {{ value.label }}
      </span>
      <span class="value-controls">
        {% if value.is_empty and not subtree %}
            <form action="" method="post">
                {% csrf_token %}
                <input type="hidden" name="det" value="value_remove"/>
                <input type="hidden" name="id" value="{{ value.pk }}"/>
                <button type="submit">
                    usuń
                </button>
            </form>
        {% endif %}
          <form action="" method="post">
              {% csrf_token %}
              <input type="hidden" name="det" value="value_rename"/>
              <input type="hidden" name="id" value="{{ value.pk }}"/>
              <input type="text" name="new_name"/>
              <button type="submit">
                  zmień nazwę
              </button>
          </form>
      </span>
            {% if subtree %}
                {% value_tree subtree %}
            {% endif %}
        </li>
    {% endfor %}
</ul>