Admin | Bugfix search_fields, hezci admin problemu.
This commit is contained in:
parent
ade44ee560
commit
dd01421b83
1 changed files with 14 additions and 15 deletions
|
@ -46,11 +46,11 @@ class OsobaAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
@admin.register(m.Organizator)
|
@admin.register(m.Organizator)
|
||||||
class OrganizatorAdmin(admin.ModelAdmin):
|
class OrganizatorAdmin(admin.ModelAdmin):
|
||||||
search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'prezdivka']
|
search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__prezdivka']
|
||||||
|
|
||||||
@admin.register(m.Resitel)
|
@admin.register(m.Resitel)
|
||||||
class ResitelAdmin(admin.ModelAdmin):
|
class ResitelAdmin(admin.ModelAdmin):
|
||||||
search_fields = ['jmeno', 'prijmeni', 'prezdivka']
|
search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__prezdivka']
|
||||||
ordering = ('osoba__jmeno','osoba__prijmeni')
|
ordering = ('osoba__jmeno','osoba__prijmeni')
|
||||||
|
|
||||||
@admin.register(m.Problem)
|
@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.
|
# Pokud chceme orezavat na aktualni rocnik, musime do modelu pridat odkaz na rocnik. Zatim bere vse.
|
||||||
search_fields = ['nazev']
|
search_fields = ['nazev']
|
||||||
|
|
||||||
@admin.register(m.Tema)
|
# V ProblemAdmin to nejde, protoze se to nepropise do deti
|
||||||
class TemaAdmin(PolymorphicChildModelAdmin):
|
class ProblemAdminMixin(object):
|
||||||
base_model = m.Tema
|
|
||||||
show_in_index = True
|
show_in_index = True
|
||||||
autocomplete_fields = ['nadproblem']
|
autocomplete_fields = ['nadproblem','autor','garant']
|
||||||
|
filter_horizontal = ['opravovatele']
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(m.Tema)
|
||||||
|
class TemaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
|
||||||
|
base_model = m.Tema
|
||||||
|
|
||||||
@admin.register(m.Clanek)
|
@admin.register(m.Clanek)
|
||||||
class ClanekAdmin(PolymorphicChildModelAdmin):
|
class ClanekAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
|
||||||
base_model = m.Clanek
|
base_model = m.Clanek
|
||||||
show_in_index = True
|
|
||||||
autocomplete_fields = ['nadproblem']
|
|
||||||
|
|
||||||
@admin.register(m.Uloha)
|
@admin.register(m.Uloha)
|
||||||
class UlohaAdmin(PolymorphicChildModelAdmin):
|
class UlohaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
|
||||||
base_model = m.Uloha
|
base_model = m.Uloha
|
||||||
show_in_index = True
|
|
||||||
autocomplete_fields = ['nadproblem']
|
|
||||||
|
|
||||||
@admin.register(m.Konfera)
|
@admin.register(m.Konfera)
|
||||||
class KonferaAdmin(PolymorphicChildModelAdmin):
|
class KonferaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin):
|
||||||
base_model = m.Konfera
|
base_model = m.Konfera
|
||||||
show_in_index = True
|
|
||||||
autocomplete_fields = ['nadproblem']
|
|
||||||
|
|
||||||
|
|
||||||
class TextAdminInline(admin.TabularInline):
|
class TextAdminInline(admin.TabularInline):
|
||||||
|
|
Loading…
Reference in a new issue