From d67f58b9ef8b5567a9b272046c769ec68029d3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sat, 6 Aug 2016 17:06:12 +0200 Subject: [PATCH] =?UTF-8?q?Admin:=20zadan=C3=A9=20probl=C3=A9my=20k=20?= =?UTF-8?q?=C4=8D=C3=ADslu=20inline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/admin.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/seminar/admin.py b/seminar/admin.py index 27e825cf..45cc5fb7 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -107,6 +107,18 @@ class PrilohaReseniInline(admin.StackedInline): extra = 0 +class ProblemInline(admin.TabularInline): + model = Problem + fk_name = 'cislo_zadani' + fields = ['kod', 'typ', 'nazev', 'body', 'opravovatel', 'stav'] + formfield_overrides = { + models.TextField: {'widget': forms.TextInput}, + } + view_on_site = Problem.verejne_url + + extra = 0 + + class ReseniKProblemuInline(admin.TabularInline): form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['resitel'], fields=['resitel']) model = Reseni @@ -244,6 +256,7 @@ class CisloAdmin(VersionAdmin): make_set_action('verejna_vysledkovka', True, u'Zveřejnit výsledkovku'), make_set_action('verejna_vysledkovka', False, u'Skrýt (zneveřejnit) výsledkovku'), ] + inlines = [ProblemInline] def get_queryset(self, request): qs = super(CisloAdmin, self).get_queryset(request)