Permalink
Browse files

correct search query when exporting csv

When a query with multiple values for a key was made, only one of the
values was being honored. Now we flatten the key/value pairs and pass
that to the template.
  • Loading branch information...
1 parent 24726cc commit 6644ab58d1132eb4490068762b19e410e3731603 @rmarianski rmarianski committed Oct 21, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −1 search/templates/search_csv.html
  2. +5 −0 search/views.py
@@ -10,7 +10,7 @@
<form method="GET"
action="{% url search_csv %}">
- {% for key,value in request.GET.items %}
+ {% for key,value in keyvals %}
<input type="hidden" name="{{key}}" value="{{value}}" />
{% endfor %}
View
@@ -972,7 +972,12 @@ def search_csv(request):
'source', 'subscription_status', 'phone', 'campus']
fields = request.GET.getlist('fields')
if not fields:
+ keyvals = []
+ for key in request.GET.keys():
+ for value in request.GET.getlist(key):
+ keyvals.append((key, value))
return dict(fields=user_fields,
+ keyvals=keyvals,
request=request)
buffer = StringIO()

0 comments on commit 6644ab5

Please sign in to comment.