From 6142f4a979ad68ed1d5a60bc959c84a2184a461c Mon Sep 17 00:00:00 2001 From: LEdoian Date: Tue, 30 Apr 2019 21:48:46 +0200 Subject: [PATCH] Admin: Fix ResitelInline --- seminar/admin.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/seminar/admin.py b/seminar/admin.py index ceff6759..281b5534 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -76,11 +76,20 @@ def create_modeladmin(modeladmin, model, name = None, verbose_name = None, verbo class ResitelInline(admin.TabularInline): model = Resitel - fields = ['jmeno', 'prijmeni', 'skola', 'mesto', 'rok_maturity', ] - readonly_fields = ['jmeno', 'prijmeni', 'skola', 'mesto', 'rok_maturity', ] + fields = ['osoba_jmeno', 'osoba_prijmeni', 'skola', 'osoba_mesto', 'rok_maturity', ] + readonly_fields = ['osoba_jmeno', 'osoba_prijmeni', 'skola', 'osoba_mesto', 'rok_maturity', ] extra = 0 view_on_site = False + def osoba_jmeno(self, obj): + return obj.osoba.jmeno + + def osoba_prijmeni(self, obj): + return obj.osoba.prijmeni + + def osoba_mesto(self, obj): + return obj.osoba.mesto + def has_add_permission(self, req): return False