diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index 012a14ef64..a2a7df945a 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -30,7 +30,7 @@ checkbox = forms.CheckboxInput({'class': 'action-select'}, lambda value: False) class AdminForm(object): def __init__(self, form, fieldsets, prepopulated_fields, readonly_fields=None, model_admin=None): - self.form, self.fieldsets = form, normalize_fieldsets(fieldsets) + self.form, self.fieldsets = form, fieldsets self.prepopulated_fields = [{ 'field': form[field_name], 'dependencies': [form[f] for f in dependencies] @@ -334,26 +334,3 @@ class AdminErrorList(forms.utils.ErrorList): self.extend(inline_formset.non_form_errors()) for errors_in_inline_form in inline_formset.errors: self.extend(list(six.itervalues(errors_in_inline_form))) - - -def normalize_fieldsets(fieldsets): - """ - Make sure the keys in fieldset dictionaries are strings. Returns the - normalized data. - """ - result = [] - for name, options in fieldsets: - result.append((name, normalize_dictionary(options))) - return result - - -def normalize_dictionary(data_dict): - """ - Converts all the keys in "data_dict" to strings. The keys must be - convertible using str(). - """ - for key, value in data_dict.items(): - if not isinstance(key, str): - del data_dict[key] - data_dict[str(key)] = value - return data_dict diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 4b0da928a2..8649b10caa 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -9,7 +9,7 @@ from django.db import models from django.db.models.fields import FieldDoesNotExist from django.utils import six from django.utils.deprecation import RenameMethodsBase -from django.utils.encoding import force_str, force_text +from django.utils.encoding import force_text from django.utils.translation import ugettext, ugettext_lazy from django.utils.http import urlencode @@ -142,14 +142,7 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): lookup_params = self.get_filters_params() use_distinct = False - # Normalize the types of keys for key, value in lookup_params.items(): - if not isinstance(key, str): - # 'key' will be used as a keyword argument later, so Python - # requires it to be a string. - del lookup_params[key] - lookup_params[force_str(key)] = value - if not self.model_admin.lookup_allowed(key, value): raise DisallowedModelAdminLookup("Filtering by %s not allowed" % key)