from django.contrib import admin from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin, PolymorphicChildModelFilter # Todo: reversion import seminar.models as m admin.site.register(m.Osoba) admin.site.register(m.Skola) admin.site.register(m.Prijemce) admin.site.register(m.Resitel) admin.site.register(m.Rocnik) admin.site.register(m.Cislo) admin.site.register(m.Organizator) admin.site.register(m.Soustredeni) @admin.register(m.Problem) class ProblemAdmin(PolymorphicParentModelAdmin): base_model = m.Problem child_models = [ m.Tema, m.Clanek, m.Uloha, ] @admin.register(m.Tema) class TemaAdmin(PolymorphicChildModelAdmin): base_model = m.Tema show_in_index = True @admin.register(m.Clanek) class ClanekAdmin(PolymorphicChildModelAdmin): base_model = m.Clanek show_in_index = True @admin.register(m.Uloha) class UlohaAdmin(PolymorphicChildModelAdmin): base_model = m.Uloha show_in_index = True admin.site.register(m.Text) admin.site.register(m.Reseni) admin.site.register(m.Hodnoceni) admin.site.register(m.PrilohaReseni) admin.site.register(m.Pohadka) admin.site.register(m.Konfera) admin.site.register(m.Obrazek) # Polymorfismus pro stromy # TODO: Inlines podle https://django-polymorphic.readthedocs.io/en/stable/admin.html @admin.register(m.TreeNode) class TreeNodeAdmin(PolymorphicParentModelAdmin): base_model = m.TreeNode child_models = [ m.RocnikNode, m.CisloNode, m.MezicisloNode, m.TemaVCisleNode, m.KonferaNode, m.ClanekNode, m.UlohaZadaniNode, m.PohadkaNode, m.UlohaVzorakNode, m.TextNode, ] @admin.register(m.RocnikNode) class RocnikNodeAdmin(PolymorphicChildModelAdmin): base_model = m.RocnikNode show_in_index = True @admin.register(m.CisloNode) class CisloNodeAdmin(PolymorphicChildModelAdmin): base_model = m.CisloNode show_in_index = True @admin.register(m.MezicisloNode) class MezicisloNodeAdmin(PolymorphicChildModelAdmin): base_model = m.MezicisloNode show_in_index = True @admin.register(m.TemaVCisleNode) class TemaVCisleNodeAdmin(PolymorphicChildModelAdmin): base_model = m.TemaVCisleNode show_in_index = True @admin.register(m.KonferaNode) class KonferaNodeAdmin(PolymorphicChildModelAdmin): base_model = m.KonferaNode show_in_index = True @admin.register(m.ClanekNode) class ClanekNodeAdmin(PolymorphicChildModelAdmin): base_model = m.ClanekNode show_in_index = True @admin.register(m.UlohaZadaniNode) class UlohaZadaniNodeAdmin(PolymorphicChildModelAdmin): base_model = m.UlohaZadaniNode show_in_index = True @admin.register(m.PohadkaNode) class PohadkaNodeAdmin(PolymorphicChildModelAdmin): base_model = m.PohadkaNode show_in_index = True @admin.register(m.UlohaVzorakNode) class UlohaVzorakNodeAdmin(PolymorphicChildModelAdmin): base_model = m.UlohaVzorakNode show_in_index = True @admin.register(m.TextNode) class TextNodeAdmin(PolymorphicChildModelAdmin): base_model = m.TextNode show_in_index = True admin.site.register(m.Nastaveni) admin.site.register(m.Novinky)