Skip to content

Commit

Permalink
fix to state/city filter
Browse files Browse the repository at this point in the history
  • Loading branch information
bahron83 committed May 31, 2018
1 parent e429c0d commit 1ad784c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion koalixcrm/crm/contact/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ class CityFilter(admin.SimpleListFilter):
def lookups(self, request, model_admin):
items = []
state = request.GET.get('state', None)
adjusted_queryset = PostalAddressForContact.objects.all() if state is None else PostalAddressForContact.objects.filter(state=state)
unique_list = PostalAddressForContact.objects.all().order_by('town')
adjusted_queryset = unique_list if state is None else unique_list.filter(state=state)
for a in adjusted_queryset.values('town').distinct():
items.append((a['town'], _(a['town'])))
return (
Expand Down

0 comments on commit 1ad784c

Please sign in to comment.