{% load i18n %} {% load rules %} {% load gestalten %} {% load events %} {% has_perm 'events.can_attend' user event_association as can_attend %} {% has_perm 'events.can_abstain' user event_association as can_abstain %} {% has_perm 'events.can_attend_group_members' user event_association.entity as can_attend_group_members %} {% if can_attend_group_members %} {# show a dropdown with non-attending group members #} {% with event_association.entity.members.all|filter_event_non_attendees:event_association.container|sort_gestalt_first:user.gestalt as non_attending_members %} {% if non_attending_members %} {% with event_association.container.pk|stringformat:"d"|add:"-select-event-attendee" as target_name %} {% endwith %} {% endif %} {% endwith %} {% elif can_attend %} {# allow the user to attend the event #}
{% csrf_token %} {% if redirect_url %} {% endif %}
{% elif can_abstain %} {# allow the user to cancel the attendance of the event #} {# TODO: replace this GET request with a javascript-based DELETE request #}
{% csrf_token %} {% if redirect_url %} {% endif %}
{% endif %}