Browse Source

Přidán TreeNode.get_admin_url()

middleware_test
Pavel 'LEdoian' Turinsky 5 years ago
parent
commit
730a7dfe5a
  1. 5
      seminar/models.py

5
seminar/models.py

@ -14,6 +14,7 @@ from django.utils.text import slugify
from django.urls import reverse
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
from django.utils.text import get_valid_filename
from imagekit.models import ImageSpecField, ProcessedImageField
from imagekit.processors import ResizeToFit, Transpose
@ -1303,6 +1304,10 @@ class TreeNode(PolymorphicModel):
def aktualizuj_nazev(self):
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 Meta:
db_table = 'seminar_nodes_rocnik'

Loading…
Cancel
Save