#80: Merged fix of r362 from default branch into 1.2-dev branch.

This commit is contained in:
Emanuel Schuetze 2012-04-02 08:31:26 +02:00
parent c2ec9e958f
commit 4045c79a17
2 changed files with 12 additions and 5 deletions

View File

@ -38,6 +38,11 @@
{{ 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" %}

View File

@ -61,7 +61,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:
@ -80,6 +80,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])