{% url "apis_core:relations:create_relation_form" relation_type as baseurlform %}
{% if object.content_type.model_class in relation_type.model_class.subj_list %}
  {% if linkify %}
    <a href="{{ relation_type.model_class.get_createview_url }}?subj_content_type={{ object.content_type.id }}&subj_object_id={{ object.id }}"
       class="text-decoration-none"
       hx-get="{{ baseurlform }}?subj_content_type={{ object.content_type.id }}&subj_object_id={{ object.id }}&hx=true&relation_types={{ relation_types }}&replace_id={{ replace_id }}&table_suffix={{ table_suffix }}"
       hx-target="#relation-dialog-content"
       onclick="relationdialog.showModal();">
    {% endif %}
    <span class="forward{% if badge %} badge bg-secondary{% else %} btn btn-sm btn-outline-secondary{% endif %}">{{ relation_type.model_class.name }}</span>
    {% if linkify %}</a>{% endif %}
{% endif %}
{% if object.content_type.model_class in relation_type.model_class.obj_list %}
  {% if linkify %}
    <a href="{{ relation_type.model_class.get_createview_url }}?obj_content_type={{ object.content_type.id }}&sobj_object_id={{ object.id }}"
       class="text-decoration-none"
       hx-get="{{ baseurlform }}?obj_content_type={{ object.content_type.id }}&obj_object_id={{ object.id }}&hx=true&relation_types={{ relation_types }}&replace_id={{ replace_id }}&reverse=True&table_suffix={{ table_suffix }}"
       hx-target="#relation-dialog-content"
       onclick="relationdialog.showModal();">
    {% endif %}
    <span class="reverse{% if badge %} badge bg-secondary{% else %} btn btn-sm btn-outline-secondary{% endif %}">{{ relation_type.model_class.reverse_name }}</span>
    {% if linkify %}</a>{% endif %}
{% endif %}
