From e92971ccb06a7909b9e48d5f71c42d4f22b95b10 Mon Sep 17 00:00:00 2001 From: Marco Richetta Date: Tue, 13 Oct 2020 01:28:14 -0300 Subject: [PATCH] Removed unnecessary check in BaseModelAdmin.get_view_on_site_url(). --- django/contrib/admin/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index bea685966e7..5c16dcfad1b 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -296,7 +296,7 @@ class BaseModelAdmin(metaclass=forms.MediaDefiningClass): if callable(self.view_on_site): return self.view_on_site(obj) - elif self.view_on_site and hasattr(obj, 'get_absolute_url'): + elif hasattr(obj, 'get_absolute_url'): # use the ContentType lookup if view_on_site is True return reverse('admin:view_on_site', kwargs={ 'content_type_id': get_content_type_for_model(obj).pk,