1
0
mirror of https://github.com/django/django.git synced 2025-07-03 17:29:12 +00:00

newforms-admin: Fixed #4074 -- Properly urlencode the ChangeList query 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
This commit is contained in:
Brian Rosner 2008-06-30 17:38:13 +00:00
parent 829fd5a967
commit 595e9191f5

View File

@ -6,6 +6,7 @@ from django.db.models.query import QuerySet
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 @@ class ChangeList(object):
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)