Autocomplete pro nadproblem

This commit is contained in:
Tomas 'Jethro' Pokorny 2021-02-09 22:03:00 +01:00
parent 600d0efd48
commit 0b46abb484

View file

@ -61,26 +61,32 @@ class ProblemAdmin(PolymorphicParentModelAdmin):
m.Uloha, m.Uloha,
m.Konfera, 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) @admin.register(m.Tema)
class TemaAdmin(PolymorphicChildModelAdmin): class TemaAdmin(PolymorphicChildModelAdmin):
base_model = m.Tema base_model = m.Tema
show_in_index = True show_in_index = True
autocomplete_fields = ['nadproblem']
@admin.register(m.Clanek) @admin.register(m.Clanek)
class ClanekAdmin(PolymorphicChildModelAdmin): class ClanekAdmin(PolymorphicChildModelAdmin):
base_model = m.Clanek base_model = m.Clanek
show_in_index = True show_in_index = True
autocomplete_fields = ['nadproblem']
@admin.register(m.Uloha) @admin.register(m.Uloha)
class UlohaAdmin(PolymorphicChildModelAdmin): class UlohaAdmin(PolymorphicChildModelAdmin):
base_model = m.Uloha base_model = m.Uloha
show_in_index = True show_in_index = True
autocomplete_fields = ['nadproblem']
@admin.register(m.Konfera) @admin.register(m.Konfera)
class KonferaAdmin(PolymorphicChildModelAdmin): class KonferaAdmin(PolymorphicChildModelAdmin):
base_model = m.Konfera base_model = m.Konfera
show_in_index = True show_in_index = True
autocomplete_fields = ['nadproblem']
class TextAdminInline(admin.TabularInline): class TextAdminInline(admin.TabularInline):