Browse Source

Autocomplete pro nadproblem

export_seznamu_prednasek
parent
commit
0b46abb484
  1. 6
      seminar/admin.py

6
seminar/admin.py

@ -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):

Loading…
Cancel
Save