From 6b9799ee356ab3aaaf1efeb94083d69d32914323 Mon Sep 17 00:00:00 2001 From: WasinTh Date: Thu, 8 Nov 2018 10:08:13 +0700 Subject: [PATCH 1/2] Fix the issue #48 https://github.com/arthanson/django-genericadmin/issues/48 --- genericadmin/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genericadmin/admin.py b/genericadmin/admin.py index 40aff4c..86d2de1 100755 --- a/genericadmin/admin.py +++ b/genericadmin/admin.py @@ -97,7 +97,7 @@ def genericadmin_js_init(self, request): if request.method == 'GET': obj_dict = {} for c in ContentType.objects.all(): - val = force_text('%s/%s' % (c.app_label, c.model)) + val = force_text('%s/%s' % (c.app_label, c.model)).lower() params = self.content_type_lookups.get('%s.%s' % (c.app_label, c.model), {}) params = url_params_from_lookup_dict(params) if self.content_type_whitelist: From 3b107be1b502497bc2a4f566665f13395942af0b Mon Sep 17 00:00:00 2001 From: WasinTh Date: Thu, 8 Nov 2018 10:27:34 +0700 Subject: [PATCH 2/2] Fix bug on wrong returned URL The first fix will return wrong URL to client. This one will preserve the capital letter case for the returned URL. --- genericadmin/admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/genericadmin/admin.py b/genericadmin/admin.py index 86d2de1..ac551f0 100755 --- a/genericadmin/admin.py +++ b/genericadmin/admin.py @@ -97,13 +97,13 @@ def genericadmin_js_init(self, request): if request.method == 'GET': obj_dict = {} for c in ContentType.objects.all(): - val = force_text('%s/%s' % (c.app_label, c.model)).lower() + val = force_text('%s/%s' % (c.app_label, c.model)) params = self.content_type_lookups.get('%s.%s' % (c.app_label, c.model), {}) params = url_params_from_lookup_dict(params) if self.content_type_whitelist: - if val in self.content_type_whitelist: + if val.lower() in self.content_type_whitelist: obj_dict[c.id] = (val, params) - elif val not in self.content_type_blacklist: + elif val.lower() not in self.content_type_blacklist: obj_dict[c.id] = (val, params) data = {