diff --git a/dsbd/utils.py b/dsbd/utils.py index 8e759dc..921330e 100644 --- a/dsbd/utils.py +++ b/dsbd/utils.py @@ -1,5 +1,4 @@ from django.conf import settings -from django.urls import reverse def get_admin_url(instance) -> str: @@ -8,10 +7,9 @@ def get_admin_url(instance) -> str: """ model_name = instance._meta.model_name app_label = instance._meta.app_label - admin_url = reverse(f"admin:{app_label}_{model_name}_change", args=[instance.pk]) # フルURLにするために現在のサイトドメインを取得 - full_admin_url = f"{settings.ADMIN_DOMAIN_URL}{admin_url}" + full_admin_url = f"{settings.ADMIN_DOMAIN_URL}/admin/{app_label}/{model_name}/{instance.pk}/change/" return full_admin_url @@ -22,9 +20,8 @@ def get_admin_history_url(instance) -> str: """ model_name = instance._meta.model_name app_label = instance._meta.app_label - admin_url = reverse(f"admin:{app_label}_{model_name}_history", args=[instance.pk]) # フルURLにするために現在のサイトドメインを取得 - admin_history_url = f"{settings.ADMIN_DOMAIN_URL}{admin_url}" + admin_history_url = f"{settings.ADMIN_DOMAIN_URL}/admin/{app_label}/{model_name}/{instance.pk}/history/" return admin_history_url