From 5efc5a20d8f5112fb2246b6d81f4244355775ec5 Mon Sep 17 00:00:00 2001 From: zubairshakoorarbisoft Date: Thu, 7 Sep 2023 19:39:56 +0500 Subject: [PATCH] fix: django-upgrade codmod executed --- enterprise_catalog/apps/catalog/admin.py | 14 +++++++++----- enterprise_catalog/apps/core/admin.py | 4 +--- enterprise_catalog/settings/base.py | 6 +++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/enterprise_catalog/apps/catalog/admin.py b/enterprise_catalog/apps/catalog/admin.py index 214415eba..f22f3ead1 100644 --- a/enterprise_catalog/apps/catalog/admin.py +++ b/enterprise_catalog/apps/catalog/admin.py @@ -85,10 +85,12 @@ class CatalogQueryAdmin(UnchangeableMixin): 'content_filter_hash', ) + @admin.display( + description='Content Filter' + ) def get_content_filter(self, obj): return obj.pretty_print_content_filter() - get_content_filter.short_description = 'Content Filter' form = CatalogQueryForm @@ -112,12 +114,13 @@ class EnterpriseCatalogAdmin(UnchangeableMixin): 'catalog_query__content_filter_hash__exact' ) + @admin.display( + description='Catalog Query' + ) def get_catalog_query(self, obj): link = reverse("admin:catalog_catalogquery_change", args=[obj.catalog_query.id]) return format_html('{}', link, obj.catalog_query.pretty_print_content_filter()) - get_catalog_query.short_description = 'Catalog Query' - @admin.register(EnterpriseCatalogRoleAssignment) class EnterpriseCatalogRoleAssignmentAdmin(UserRoleAssignmentAdmin): @@ -130,6 +133,9 @@ class EnterpriseCatalogRoleAssignmentAdmin(UserRoleAssignmentAdmin): 'enterprise_id', ) + @admin.display( + description='User' + ) def get_username(self, obj): return obj.user.username @@ -143,7 +149,5 @@ class Meta: fields = ('user', 'role', 'enterprise_id', 'applies_to_all_contexts') form = EnterpriseCatalogRoleAssignmentAdminForm - get_username.short_description = 'User' - admin.site.register(CatalogUpdateCommandConfig, ConfigurationModelAdmin) diff --git a/enterprise_catalog/apps/core/admin.py b/enterprise_catalog/apps/core/admin.py index 849ff473e..230e96949 100644 --- a/enterprise_catalog/apps/core/admin.py +++ b/enterprise_catalog/apps/core/admin.py @@ -7,6 +7,7 @@ from enterprise_catalog.apps.core.models import User +@admin.register(User) class CustomUserAdmin(UserAdmin): """ Admin configuration for the custom User model. """ list_display = ('username', 'email', 'full_name', 'first_name', 'last_name', 'is_staff') @@ -17,6 +18,3 @@ class CustomUserAdmin(UserAdmin): 'groups', 'user_permissions')}), (_('Important dates'), {'fields': ('last_login', 'date_joined')}), ) - - -admin.site.register(User, CustomUserAdmin) diff --git a/enterprise_catalog/settings/base.py b/enterprise_catalog/settings/base.py index b02d45499..2ff749b33 100644 --- a/enterprise_catalog/settings/base.py +++ b/enterprise_catalog/settings/base.py @@ -369,7 +369,11 @@ } SESSION_EXPIRE_AT_BROWSER_CLOSE = False SOCIAL_AUTH_REDIRECT_IS_HTTPS = False -STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' +STORAGES = { + "staticfiles": { + "BACKEND": 'django.contrib.staticfiles.storage.StaticFilesStorage', + }, +} # How long we keep API Client data in cache. (seconds) ONE_HOUR = 60 * 60