|
|
@ -203,6 +203,7 @@ class Soustredeni_OrganizatoriInline(admin.TabularInline): |
|
|
|
|
|
|
|
class ResitelAdmin(VersionAdmin): |
|
|
|
form = autocomplete_light.modelform_factory(Resitel, autocomplete_fields=['skola'], fields=['skola']) |
|
|
|
fk_name = 'osoba' |
|
|
|
fieldsets = [ |
|
|
|
(None, {'fields': ['jmeno', 'prijmeni', 'user']}), |
|
|
|
(u'Škola', {'fields': ['skola', 'rok_maturity']}), |
|
|
@ -210,12 +211,33 @@ class ResitelAdmin(VersionAdmin): |
|
|
|
(u'Osobní údaje', {'fields': ['pohlavi_muz', 'datum_narozeni', 'email', 'telefon']}), |
|
|
|
(u'Adresa', {'fields': ['ulice', 'mesto', 'psc', 'stat']}), |
|
|
|
] |
|
|
|
list_display = ['jmeno', 'prijmeni', 'user', 'pohlavi_muz', 'skola', 'rok_maturity', 'pocet_reseni'] |
|
|
|
list_filter = ['pohlavi_muz', 'rok_maturity', 'zasilat'] |
|
|
|
search_fields = ['jmeno', 'prijmeni', 'ulice', 'mesto', 'email'] |
|
|
|
list_display = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__user', 'osoba__pohlavi_muz', 'skola', 'rok_maturity', 'pocet_reseni'] |
|
|
|
list_filter = ['osoba__pohlavi_muz', 'rok_maturity', 'zasilat'] |
|
|
|
search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__ulice', 'osoba__mesto', 'osoba__email'] |
|
|
|
inlines = [ReseniKResiteliInline] |
|
|
|
view_on_site = False |
|
|
|
|
|
|
|
def osoba__jmeno(self, obj): |
|
|
|
return obj.osoba.jmeno |
|
|
|
|
|
|
|
def osoba__prijmeni(self, obj): |
|
|
|
return obj.osoba.prijmeni |
|
|
|
|
|
|
|
def osoba__user(self, obj): |
|
|
|
return obj.osoba.user |
|
|
|
|
|
|
|
def osoba__pohlavi_muz(self, obj): |
|
|
|
return obj.osoba.pohlavi_muz |
|
|
|
|
|
|
|
def osoba__ulice(self, obj): |
|
|
|
return obj.osoba.ulice |
|
|
|
|
|
|
|
def osoba__mesto(self, obj): |
|
|
|
return obj.osoba.mesto |
|
|
|
|
|
|
|
def osoba__email(self, obj): |
|
|
|
return obj.osoba.email |
|
|
|
|
|
|
|
def get_queryset(self, request): |
|
|
|
qs = super(ResitelAdmin, self).get_queryset(request) |
|
|
|
return qs.select_related('skola', 'user').annotate(pocet_reseni=Count('reseni')) |
|
|
|