{% if form %} {% if user.is_authenticated %}
{% csrf_token %} {{ form }} {% with form.bookmark_exists as exists %} {# another hidden input is created to handle javascript submit event #} {% endwith %}
{% else %} add {% endif %} {% endif %}