From 9ee82f72a7c4619bbe3010e86e34d3b38c771fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 29 Oct 2024 19:12:25 +0100 Subject: [PATCH] =?UTF-8?q?SeminarModelBase.admin=5Furl=20nyn=C3=AD=20um?= =?UTF-8?q?=C3=AD=20i=20modely=20v=20jin=C3=BDch=20appk=C3=A1ch=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/models/base.py | 5 +++-- soustredeni/models.py | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/seminar/models/base.py b/seminar/models/base.py index 1069f165..6ea34242 100644 --- a/seminar/models/base.py +++ b/seminar/models/base.py @@ -14,8 +14,9 @@ class SeminarModelBase(models.Model): # return "https://" + str(get_current_site(None)) + self.verejne_url() def admin_url(self): - model_name = self.__class__.__name__.lower() - return reverse('admin:seminar_{}_change'.format(model_name), args=(self.id, )) + app_name = self._meta.app_label + model_name = self._meta.model_name + return reverse('admin:{}_{}_change'.format(app_name, model_name), args=(self.id, )) # def verejne_url(self): # return None diff --git a/soustredeni/models.py b/soustredeni/models.py index 56db6974..fb5c5239 100644 --- a/soustredeni/models.py +++ b/soustredeni/models.py @@ -77,10 +77,6 @@ class Soustredeni(SeminarModelBase): #return reverse('seminar_soustredeni', kwargs={'pk': self.id}) return reverse('seminar_seznam_soustredeni') - def admin_url(self): - model_name = self.__class__.__name__.lower() - return reverse('admin:soustredeni_{}_change'.format(model_name), args=(self.id, )) - @reversion.register(ignore_duplicates=True) class Soustredeni_Ucastnici(SeminarModelBase):