{% extends "generic/cid_group_base.html" %}
<!-- {% load static from static %} -->
{% load crispy_forms_tags %}

{% block css %}
{% endblock %}
{% block js %}
    <!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
    {{form.media}}

    <script type="text/javascript">
    </script>

    <!-- {{ form.media }} -->
{% endblock %}
{% block content %}
    {% if form.instance.id %}
        <h2>Edit Group: {{userusergroup.name}}</h2>
    {% else %}
        <h2>Add New Group</h2>
    {% endif %}
    Use this form to create / edit a User group.<br/>
    <form action="" method="post" enctype="multipart/form-data" id="condition-form" class="inline-form">
        {% csrf_token %}

        {{ form|crispy }}
        <input type="submit" class="submit-button" value="Submit" name="submit">


    </form>
    <div>
        <h3>Users</h3>

        <ul>
            {% for user in userusergroup.users.all %}
                <li><a href="{% url 'account_profile' user.username %}">{{user.username}}</a> [{{user.first_name}} {{user.last_name}}] {{user.userprofile.grade}}</li>

            {% empty %}
                <li>Group currently has no users.</li>
            {% endfor %}
        </ul>
        Count: {{userusergroup.users.count}}
    </div>

    {% comment %}         {% if userusergroup.users.all %}
            {{userusergroup.GetGroupUsers}}
        {% else %}
            No users currently added to group.
        {% endif %} {% endcomment %}
{% endblock %}