From deb36ea7a170768d0305a6afec7aa2af993db304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sat, 18 Feb 2017 22:32:52 +0100 Subject: [PATCH] =?UTF-8?q?Seznam=20p=C5=99edn=C3=A1=C5=A1ek:=20u=C5=BE?= =?UTF-8?q?=C5=A1=C3=AD=20popis=20a=20escapov=C3=A1n=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prednasky/admin.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/prednasky/admin.py b/prednasky/admin.py index 1e5c5889..a9b94ee0 100644 --- a/prednasky/admin.py +++ b/prednasky/admin.py @@ -2,35 +2,40 @@ from django.contrib import admin from django.contrib import messages from reversion.admin import VersionAdmin +from django.utils.safestring import mark_safe +from django.utils.html import escape from models import Prednaska, Seznam, STAV_NAVRH from seminar.models import Soustredeni -from django.utils.safestring import mark_safe class Seznam_PrednaskaInline(admin.TabularInline): model = Prednaska.seznamy.through extra = 0 - def prednaska__nazev(self, instance): + def prednaska__nazev(self, obj): return mark_safe( u"{}".format( - instance.prednaska.id, - instance.prednaska.nazev + obj.prednaska.id, + escape(obj.prednaska.nazev) ) ) - def prednaska__popis(self, instance): - return instance.prednaska.popis + def prednaska__popis(self, obj): + return mark_safe( + u"
{}
".format( + escape(obj.prednaska.popis) + ) + ) - def prednaska__anotace(self, instance): - return instance.prednaska.anotace + def prednaska__anotace(self, obj): + return obj.prednaska.anotace - def prednaska__org(self, instance): - return instance.prednaska.org + def prednaska__org(self, obj): + return obj.prednaska.org - def prednaska__obor(self, instance): - return instance.prednaska.obor + def prednaska__obor(self, obj): + return obj.prednaska.obor prednaska__nazev.short_description = u'Přednáška' prednaska__popis.short_description = u'Popis pro orgy'