From 9ac0d06e1e673005ae05d058a17ad7a7d60d6b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 10 Aug 2023 12:39:11 +0200 Subject: [PATCH] =?UTF-8?q?Dal=C5=A1=C3=AD=20drobn=C3=A9=20=C3=BApravy:=20?= =?UTF-8?q?admin=5Furl=20pot=C5=99ebuje=20app=5Flabel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/models/base.py | 3 ++- tvorba/models.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/seminar/models/base.py b/seminar/models/base.py index 1069f165..48226973 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): + app_name = self._meta.app_label model_name = self.__class__.__name__.lower() - return reverse('admin:seminar_{}_change'.format(model_name), args=(self.id, )) + return reverse('admin:{}_{}_change'.format(app_name, model_name), args=(self.id, )) # def verejne_url(self): # return None diff --git a/tvorba/models.py b/tvorba/models.py index fd7a62da..f06edfe1 100644 --- a/tvorba/models.py +++ b/tvorba/models.py @@ -522,7 +522,7 @@ class Problem(SeminarModelBase,PolymorphicModel): return reverse('seminar_problem', kwargs={'pk': self.id}) def admin_url(self): - return reverse('admin:seminar_problem_change', args=(self.id, )) + return reverse('admin:tvorba_problem_change', args=(self.id, )) @cached_property def hlavni_problem(self):