From 5d8de808a4ae48fbfd30d903bef89f0acc3e4ef0 Mon Sep 17 00:00:00 2001 From: monodo Date: Tue, 28 May 2024 11:33:13 +0200 Subject: [PATCH 1/2] fix call to url that does not exist --- geocity/apps/accounts/admin.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/geocity/apps/accounts/admin.py b/geocity/apps/accounts/admin.py index e466f849b..ddd57d2ec 100644 --- a/geocity/apps/accounts/admin.py +++ b/geocity/apps/accounts/admin.py @@ -1011,13 +1011,11 @@ def sortable_str(self, obj): @admin.display(boolean=True) def has_background_image(self, obj): - try: - return obj.background_image.url is not None - except ValueError: - return False + return False if obj.background_image.name == "" else True - has_background_image.admin_order_field = "background_image" - has_background_image.short_description = "Image de fond" + if has_background_image: + has_background_image.admin_order_field = "background_image" + has_background_image.short_description = "Image de fond" # Inline for base Django Site From d5fca1a4d4917cbe5062becd437909c7777ef89e Mon Sep 17 00:00:00 2001 From: monodo Date: Tue, 28 May 2024 15:34:32 +0200 Subject: [PATCH 2/2] adress review comments --- geocity/apps/accounts/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geocity/apps/accounts/admin.py b/geocity/apps/accounts/admin.py index ddd57d2ec..7e582f735 100644 --- a/geocity/apps/accounts/admin.py +++ b/geocity/apps/accounts/admin.py @@ -1011,7 +1011,7 @@ def sortable_str(self, obj): @admin.display(boolean=True) def has_background_image(self, obj): - return False if obj.background_image.name == "" else True + return True if obj.background_image.name else False if has_background_image: has_background_image.admin_order_field = "background_image"