Changeset 9ea4909


Ignore:
Timestamp:
Aug 24, 2011, 10:44:20 PM (15 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage, test-hooks
Children:
6a646ce
Parents:
7b57a9b
git-author:
Alex Dehnert <adehnert@…> (08/24/11 22:34:43)
git-committer:
Alex Dehnert <adehnert@…> (08/24/11 22:44:20)
Message:

Allow filtering the groups for the signatory list

Location:
asadb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/views.py

    r7b57a9b r9ea4909  
    392392    # TODO:
    393393    # * limit which columns (roles) get displayed
    394     # * limit which rows get displayed (maybe) by category or something
    395394    # This might want to wait for the generic reporting infrastructure, since
    396395    # I'd imagine some of it can be reused.
    397396
     397    the_groups = groups.models.Group.objects.all()
     398    groups_filterset = GroupFilter(request.GET, the_groups)
     399    the_groups = groups_filterset.qs
    398400    officers = groups.models.OfficeHolder.objects.filter(start_time__lte=datetime.datetime.now(), end_time__gte=datetime.datetime.now())
     401    officers = officers.filter(group__in=the_groups)
    399402    officers = officers.select_related(depth=1)
    400     all_groups = groups.models.Group.objects.all()
    401403    roles = groups.models.OfficerRole.objects.all()
    402404    officers_map = collections.defaultdict(lambda: collections.defaultdict(set))
     
    404406        officers_map[officer.group][officer.role].add(officer.person)
    405407    officers_data = []
    406     for group in all_groups:
     408    for group in the_groups:
    407409        role_list = []
    408410        for role in roles:
     
    413415        'roles': roles,
    414416        'officers': officers_data,
     417        'filter': groups_filterset,
    415418    }
    416419    return render_to_response('groups/groups_signatories.html', context, context_instance=RequestContext(request), )
  • asadb/template/groups/groups_signatories.html

    r3107c52 r9ea4909  
    55
    66<h1>Signatory list</h1>
     7
     8<h2>Search</h2>
     9
     10<form action="" method="get">
     11    <table class='pretty-table'>
     12    {{ filter.form.as_table }}
     13    </table>
     14    <input type="submit" value="Search" />
     15</form>
     16
     17<h2>The Groups</h2>
    718
    819{% if changes %}
Note: See TracChangeset for help on using the changeset viewer.