Changeset f610262
- Timestamp:
- Mar 23, 2013, 11:36:03 PM (13 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- 1cfab5a
- Parents:
- 26826c9
- git-author:
- Alex Dehnert <adehnert@…> (03/23/13 23:36:03)
- git-committer:
- Alex Dehnert <adehnert@…> (03/23/13 23:36:03)
- Location:
- asadb
- Files:
-
- 2 edited
-
forms/views.py (modified) (3 diffs)
-
template/midway/map.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/forms/views.py
r26826c9 rf610262 22 22 from django.db import connection 23 23 from django.db.models import Q, Count 24 25 import django_filters 24 26 25 27 import forms.models … … 564 566 565 567 568 class MidwayAssignmentFilter(django_filters.FilterSet): 569 name = django_filters.CharFilter(name='group__name', lookup_type='icontains', label="Name contains") 570 abbreviation = django_filters.CharFilter(name='group__abbreviation', lookup_type='iexact', label="Abbreviation is") 571 activity_category = django_filters.ModelChoiceFilter( 572 label='Activity category', 573 name='group__activity_category', 574 queryset=groups.models.ActivityCategory.objects, 575 ) 576 577 class Meta: 578 model = forms.models.MidwayAssignment 579 fields = [ 580 'name', 581 'abbreviation', 582 'activity_category', 583 ] 584 order_by = ( 585 ('group__name', 'Name', ), 586 ('group__abbreviation', 'Abbreviation', ), 587 ('group__activity_category__name', 'Activity category', ), 588 ('location', 'Location', ), 589 ) 566 590 567 591 class MidwayMapView(DetailView): … … 574 598 context = super(MidwayMapView, self).get_context_data(**kwargs) 575 599 576 midway = context['midway']577 assignments = forms.models.MidwayAssignment.objects.filter(midway=midway)578 context[' assignments'] = assignments600 filterset = MidwayAssignmentFilter(self.request.GET) 601 context['assignments'] = filterset.qs 602 context['filter'] = filterset 579 603 context['pagename'] = 'midway' 580 604 -
asadb/template/midway/map.html
rcf509c0 rf610262 16 16 <tr> 17 17 <th>Group</th> 18 <th>Table</th> 18 <th>Category</th> 19 <th>Location</th> 19 20 <th>Website</th> 20 21 </tr> … … 22 23 <tr> 23 24 <th>{{assignment.group}}</th> 25 <td>{% if assignment.group.activity_category %}{{assignment.group.activity_category}}{% endif %}</td> 24 26 <td>{{assignment.location}}</td> 25 27 <td>{% if assignment.group.website_url %}<a href='{{assignment.group.website_url}}'>Website</a>{% endif %}</td> … … 28 30 </table> 29 31 32 <h2>Sort the assignments</h2> 33 34 <form action="" method="get"> 35 <table class='pretty-table'> 36 {{ filter.form.as_table }} 37 </table> 38 <input type="submit" value="Search" /> 39 </form> 40 30 41 {% endblock %}
Note: See TracChangeset
for help on using the changeset viewer.