Permalink
Browse files

newforms-admin: Fixed #4074 -- Properly urlencode the ChangeList quer…

…y string when the value has an ampersand. Thanks Tony Perkins and SmileyChris.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7810 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 829fd5a commit 595e9191f519af9b1c0c4b657fd3923c0997938c @brosner brosner committed Jun 30, 2008
Showing with 6 additions and 4 deletions.
  1. +6 −4 django/contrib/admin/views/main.py
@@ -6,6 +6,7 @@
from django.utils.encoding import force_unicode, smart_str
from django.utils.translation import ugettext
from django.utils.safestring import mark_safe
+from django.utils.http import urlencode
import operator
try:
@@ -100,11 +101,12 @@ def get_query_string(self, new_params=None, remove=None):
if k.startswith(r):
del p[k]
for k, v in new_params.items():
- if k in p and v is None:
- del p[k]
- elif v is not None:
+ if v is None:
+ if k in p:
+ del p[k]
+ else:
p[k] = v
- return mark_safe('?' + '&'.join([u'%s=%s' % (k, v) for k, v in p.items()]).replace(' ', '%20'))
+ return '?%s' % urlencode(p)
def get_results(self, request):
paginator = QuerySetPaginator(self.query_set, self.list_per_page)

0 comments on commit 595e919

Please sign in to comment.