Fix TypeError on Python 3 when querystring is preserved in the admin.

Fixes: #263
fix_request_path_info
Diederik van der Boor 2017-04-06 14:11:56 +02:00
parent 490f968353
commit a8bfb5007e
1 changed files with 3 additions and 1 deletions

View File

@ -359,7 +359,9 @@ class PolymorphicParentModelAdmin(admin.ModelAdmin):
extra_qs = ''
if request.META['QUERY_STRING']:
extra_qs = '&' + request.META['QUERY_STRING']
# QUERY_STRING is bytes in Python 3, using force_text() to decode it as string.
# See QueryDict how Django deals with that.
extra_qs = '&{0}'.format(force_text(request.META['QUERY_STRING']))
choices = self.get_child_type_choices(request, 'add')
if len(choices) == 1: