#80: New participant status filter
This commit is contained in:
parent
e5ef0ac424
commit
ebbacfd443
@ -8,20 +8,20 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{%trans "Filter" %}:
|
{%trans "Filter" %}:
|
||||||
<select class="default-input" name="gender" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="gender" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Gender" %}--</option>
|
<option value="---">-- {%trans "Gender" %} --</option>
|
||||||
<option value="male" {% if 'male' in sortfilter.gender %}selected{% endif %}>{%trans "Male" %}</option>
|
<option value="male" {% if 'male' in sortfilter.gender %}selected{% endif %}>{%trans "Male" %}</option>
|
||||||
<option value="female" {% if 'female' in sortfilter.gender %}selected{% endif %}>{%trans "Female" %}</option>
|
<option value="female" {% if 'female' in sortfilter.gender %}selected{% endif %}>{%trans "Female" %}</option>
|
||||||
<option value="" {% if '' in sortfilter.gender %}selected{% endif %}>{%trans "Not specified" %}</option>
|
<option value="" {% if '' in sortfilter.gender %}selected{% endif %}>{%trans "Not specified" %}</option>
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="group" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="group" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Group" %}--</option>
|
<option value="---">-- {%trans "Group" %} --</option>
|
||||||
{% for group in groups %}
|
{% for group in groups %}
|
||||||
<option value="{{ group }}" {% if group in sortfilter.group %}selected{% endif %}>
|
<option value="{{ group }}" {% if group in sortfilter.group %}selected{% endif %}>
|
||||||
{{ group }}</option>
|
{{ group }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="type" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="type" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Type" %}--</option>
|
<option value="---">-- {%trans "Type" %} --</option>
|
||||||
<option value="delegate" {% if 'delegate' in sortfilter.type %}selected{% endif %}>{%trans "Delegate" %}</option>
|
<option value="delegate" {% if 'delegate' in sortfilter.type %}selected{% endif %}>{%trans "Delegate" %}</option>
|
||||||
<option value="observer" {% if 'observer' in sortfilter.type %}selected{% endif %}>{%trans "Observer" %}</option>
|
<option value="observer" {% if 'observer' in sortfilter.type %}selected{% endif %}>{%trans "Observer" %}</option>
|
||||||
<option value="staff" {% if 'staff' in sortfilter.type %}selected{% endif %}>{%trans "Staff" %}</option>
|
<option value="staff" {% if 'staff' in sortfilter.type %}selected{% endif %}>{%trans "Staff" %}</option>
|
||||||
@ -29,12 +29,17 @@
|
|||||||
<option value="" {% if '' in sortfilter.type %}selected{% endif %}>{%trans "Not specified" %}</option>
|
<option value="" {% if '' in sortfilter.type %}selected{% endif %}>{%trans "Not specified" %}</option>
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="committee" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="committee" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Committee" %}--</option>
|
<option value="---">-- {%trans "Committee" %} --</option>
|
||||||
{% for committee in committees %}
|
{% for committee in committees %}
|
||||||
<option value="{{ committee }}" {% if committee in sortfilter.committee %}selected{% endif %}>
|
<option value="{{ committee }}" {% if committee in sortfilter.committee %}selected{% endif %}>
|
||||||
{{ committee }}</option>
|
{{ committee }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
<select class="default-input" name="status" onchange="document.forms['filter'].submit()">
|
||||||
|
<option value="---">-- {%trans "Status" %} --</option>
|
||||||
|
<option value="1" {% if '1' in sortfilter.status %}selected{% endif %}>{%trans "Active" %}</option>
|
||||||
|
<option value="0" {% if '0' in sortfilter.status %}selected{% endif %}>{%trans "Inactive" %}</option>
|
||||||
|
</select>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
{{ users|length }} {% trans "Participant" %}
|
{{ users|length }} {% trans "Participant" %}
|
||||||
|
@ -60,7 +60,7 @@ def get_overview(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
sortfilter = {}
|
sortfilter = {}
|
||||||
|
|
||||||
for value in [u'gender', u'group', u'type', u'committee', u'sort', u'reverse']:
|
for value in [u'gender', u'group', u'type', u'committee', u'status', u'sort', u'reverse']:
|
||||||
if value in request.REQUEST:
|
if value in request.REQUEST:
|
||||||
if request.REQUEST[value] == '---':
|
if request.REQUEST[value] == '---':
|
||||||
try:
|
try:
|
||||||
@ -79,6 +79,8 @@ def get_overview(request):
|
|||||||
query = query.filter(profile__type__iexact=sortfilter['type'][0])
|
query = query.filter(profile__type__iexact=sortfilter['type'][0])
|
||||||
if 'committee' in sortfilter:
|
if 'committee' in sortfilter:
|
||||||
query = query.filter(profile__committee__iexact=sortfilter['committee'][0])
|
query = query.filter(profile__committee__iexact=sortfilter['committee'][0])
|
||||||
|
if 'status' in sortfilter:
|
||||||
|
query = query.filter(is_active=sortfilter['status'][0])
|
||||||
if 'sort' in sortfilter:
|
if 'sort' in sortfilter:
|
||||||
if sortfilter['sort'][0] in ['first_name', 'last_name','username','last_login','email']:
|
if sortfilter['sort'][0] in ['first_name', 'last_name','username','last_login','email']:
|
||||||
query = query.order_by(sortfilter['sort'][0])
|
query = query.order_by(sortfilter['sort'][0])
|
||||||
|
Loading…
Reference in New Issue
Block a user