From 0b46abb4847089e665e574c91de6b7948fdb5c99 Mon Sep 17 00:00:00 2001 From: Tomas 'Jethro' Pokorny Date: Tue, 9 Feb 2021 22:03:00 +0100 Subject: [PATCH] Autocomplete pro nadproblem --- seminar/admin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/seminar/admin.py b/seminar/admin.py index 21951ea4..9f780cf2 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -61,26 +61,32 @@ class ProblemAdmin(PolymorphicParentModelAdmin): m.Uloha, m.Konfera, ] + # Pokud chceme orezavat na aktualni rocnik, musime do modelu pridat odkaz na rocnik. Zatim bere vse. + search_fields = ['nazev'] @admin.register(m.Tema) class TemaAdmin(PolymorphicChildModelAdmin): base_model = m.Tema show_in_index = True + autocomplete_fields = ['nadproblem'] @admin.register(m.Clanek) class ClanekAdmin(PolymorphicChildModelAdmin): base_model = m.Clanek show_in_index = True + autocomplete_fields = ['nadproblem'] @admin.register(m.Uloha) class UlohaAdmin(PolymorphicChildModelAdmin): base_model = m.Uloha show_in_index = True + autocomplete_fields = ['nadproblem'] @admin.register(m.Konfera) class KonferaAdmin(PolymorphicChildModelAdmin): base_model = m.Konfera show_in_index = True + autocomplete_fields = ['nadproblem'] class TextAdminInline(admin.TabularInline):