Skip to content

Commit

Permalink
fix: django-upgrade codmod executed
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairshakoorarbisoft committed Sep 7, 2023
1 parent 13f6034 commit 5efc5a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 9 additions & 5 deletions enterprise_catalog/apps/catalog/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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('<a href="{}">{}</a>', link, obj.catalog_query.pretty_print_content_filter())

get_catalog_query.short_description = 'Catalog Query'


@admin.register(EnterpriseCatalogRoleAssignment)
class EnterpriseCatalogRoleAssignmentAdmin(UserRoleAssignmentAdmin):
Expand All @@ -130,6 +133,9 @@ class EnterpriseCatalogRoleAssignmentAdmin(UserRoleAssignmentAdmin):
'enterprise_id',
)

@admin.display(
description='User'
)
def get_username(self, obj):
return obj.user.username

Expand All @@ -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)
4 changes: 1 addition & 3 deletions enterprise_catalog/apps/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -17,6 +18,3 @@ class CustomUserAdmin(UserAdmin):
'groups', 'user_permissions')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)


admin.site.register(User, CustomUserAdmin)
6 changes: 5 additions & 1 deletion enterprise_catalog/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5efc5a2

Please sign in to comment.