|
@ -445,9 +445,12 @@ class ProblemNavrhAdmin(ProblemAdmin): |
|
|
|
|
|
|
|
|
create_modeladmin(ProblemNavrhAdmin, Problem, 'ProblemNavrh', verbose_name=u'Problém (návrh)', verbose_name_plural=u'Problémy (návrhy)') |
|
|
create_modeladmin(ProblemNavrhAdmin, Problem, 'ProblemNavrh', verbose_name=u'Problém (návrh)', verbose_name_plural=u'Problémy (návrhy)') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProblemZadanyAdmin(ProblemAdmin): |
|
|
class ProblemZadanyAdmin(ProblemAdmin): |
|
|
list_display = ['nazev', 'typ', 'autor', 'opravovatel', 'kod', 'cislo_zadani', 'pocet_reseni', 'verejne'] |
|
|
list_display = ['nazev', 'typ', 'autor', 'opravovatel', 'kod', 'verejne'] |
|
|
list_filter = ['typ', 'zamereni', 'cislo_zadani__cislo', 'cislo_zadani__rocnik'] |
|
|
list_filter = [ |
|
|
|
|
|
'typ', 'zamereni', 'cislo_zadani__cislo', 'cislo_zadani__rocnik' |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
def get_inline_instances(self, request, obj=None): |
|
|
def get_inline_instances(self, request, obj=None): |
|
|
if obj and obj.typ == Problem.TYP_ULOHA: |
|
|
if obj and obj.typ == Problem.TYP_ULOHA: |
|
@ -459,7 +462,7 @@ class ProblemZadanyAdmin(ProblemAdmin): |
|
|
|
|
|
|
|
|
def get_queryset(self, request): |
|
|
def get_queryset(self, request): |
|
|
qs = super(ProblemZadanyAdmin, self).get_queryset(request) |
|
|
qs = super(ProblemZadanyAdmin, self).get_queryset(request) |
|
|
return qs.filter(stav=Problem.STAV_ZADANY).annotate(pocet_reseni=Count('reseni')) |
|
|
return qs.filter(stav=Problem.STAV_ZADANY) |
|
|
|
|
|
|
|
|
get_form = get_form_predvypln_autora |
|
|
get_form = get_form_predvypln_autora |
|
|
|
|
|
|
|
|