Admin: Fix ResitelInline

This commit is contained in:
LEdoian 2019-04-30 21:48:46 +02:00
parent 3007ac3433
commit 6142f4a979

View file

@ -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