Browse Source

Admin | Bugfix search_fields, hezci admin problemu.

export_seznamu_prednasek
parent
commit
dd01421b83
  1. 27
      seminar/admin.py

27
seminar/admin.py

@ -46,11 +46,11 @@ class OsobaAdmin(admin.ModelAdmin):
@admin.register(m.Organizator)
class OrganizatorAdmin(admin.ModelAdmin):
search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'prezdivka']
search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__prezdivka']
@admin.register(m.Resitel)
class ResitelAdmin(admin.ModelAdmin):
search_fields = ['jmeno', 'prijmeni', 'prezdivka']
search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__prezdivka']
ordering = ('osoba__jmeno','osoba__prijmeni')
@admin.register(m.Problem)
@ -65,29 +65,28 @@ class ProblemAdmin(PolymorphicParentModelAdmin):
# Pokud chceme orezavat na aktualni rocnik, musime do modelu pridat odkaz na rocnik. Zatim bere vse.
search_fields = ['nazev']
# V ProblemAdmin to nejde, protoze se to nepropise do deti
class ProblemAdminMixin(object):
show_in_index = True
autocomplete_fields = ['nadproblem','autor','garant']
filter_horizontal = ['opravovatele']
@admin.register(m.Tema)
class TemaAdmin(PolymorphicChildModelAdmin):
class TemaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
base_model = m.Tema
show_in_index = True
autocomplete_fields = ['nadproblem']
@admin.register(m.Clanek)
class ClanekAdmin(PolymorphicChildModelAdmin):
class ClanekAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
base_model = m.Clanek
show_in_index = True
autocomplete_fields = ['nadproblem']
@admin.register(m.Uloha)
class UlohaAdmin(PolymorphicChildModelAdmin):
class UlohaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
base_model = m.Uloha
show_in_index = True
autocomplete_fields = ['nadproblem']
@admin.register(m.Konfera)
class KonferaAdmin(PolymorphicChildModelAdmin):
class KonferaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
base_model = m.Konfera
show_in_index = True
autocomplete_fields = ['nadproblem']
class TextAdminInline(admin.TabularInline):

Loading…
Cancel
Save