Přidán TreeNode.get_admin_url()
This commit is contained in:
parent
39dc2d8e32
commit
730a7dfe5a
1 changed files with 5 additions and 0 deletions
|
@ -14,6 +14,7 @@ from django.utils.text import slugify
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.utils.text import get_valid_filename
|
from django.utils.text import get_valid_filename
|
||||||
from imagekit.models import ImageSpecField, ProcessedImageField
|
from imagekit.models import ImageSpecField, ProcessedImageField
|
||||||
from imagekit.processors import ResizeToFit, Transpose
|
from imagekit.processors import ResizeToFit, Transpose
|
||||||
|
@ -1303,6 +1304,10 @@ class TreeNode(PolymorphicModel):
|
||||||
def aktualizuj_nazev(self):
|
def aktualizuj_nazev(self):
|
||||||
raise NotImplementedError("Pokus o aktualizaci názvu obecného TreeNode místo konkrétní instance")
|
raise NotImplementedError("Pokus o aktualizaci názvu obecného TreeNode místo konkrétní instance")
|
||||||
|
|
||||||
|
def get_admin_url(self):
|
||||||
|
content_type = ContentType.objects.get_for_model(self.__class__)
|
||||||
|
return reverse("admin:%s_%s_change" % (content_type.app_label, content_type.model), args=(self.id,))
|
||||||
|
|
||||||
class RocnikNode(TreeNode):
|
class RocnikNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'seminar_nodes_rocnik'
|
db_table = 'seminar_nodes_rocnik'
|
||||||
|
|
Loading…
Reference in a new issue