Compare commits
3 commits
5d4b600b00
...
9460c484f7
Author | SHA1 | Date | |
---|---|---|---|
9460c484f7 | |||
2767e82f11 | |||
42c651ceb7 |
3 changed files with 33 additions and 1 deletions
|
@ -36,6 +36,7 @@ extensions = [
|
||||||
'sphinx.ext.intersphinx',
|
'sphinx.ext.intersphinx',
|
||||||
'sphinx.ext.autosectionlabel',
|
'sphinx.ext.autosectionlabel',
|
||||||
'myst_parser',
|
'myst_parser',
|
||||||
|
'sphinxcontrib_django',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
|
|
@ -58,10 +58,40 @@ class Seznam_PrednaskaInline(admin.TabularInline):
|
||||||
def has_add_permission(self, req, obj): return False
|
def has_add_permission(self, req, obj): return False
|
||||||
|
|
||||||
|
|
||||||
|
class Seznam_ZnalostInline(admin.TabularInline):
|
||||||
|
"""
|
||||||
|
Pomůcka pro :py:class:`prednasky.admin.SeznamAdmin` zobrazující hezky :py:class:`Znalosti <prednasky.models.Znalost>`
|
||||||
|
v adminu :py:class:`Seznamu <prednasky.models.Seznam>`.
|
||||||
|
"""
|
||||||
|
model = Znalost.seznamy.through
|
||||||
|
extra = 0
|
||||||
|
|
||||||
|
def znalost__nazev(self, obj):
|
||||||
|
return mark_safe(
|
||||||
|
f"<a href='/admin/prednasky/znalost/{obj.znalost.id}'>{obj.znalost.nazev}</a>"
|
||||||
|
)
|
||||||
|
|
||||||
|
def znalost__text(self, obj):
|
||||||
|
return mark_safe(
|
||||||
|
f"<div style='width: 200px'>{escape(obj.znalost.text)}</div>"
|
||||||
|
)
|
||||||
|
|
||||||
|
znalost__nazev.short_description = u'Přednáška'
|
||||||
|
znalost__text.short_description = u'Popis pro orgy'
|
||||||
|
|
||||||
|
readonly_fields = [
|
||||||
|
'znalost__nazev',
|
||||||
|
'znalost__text',
|
||||||
|
]
|
||||||
|
exclude = ['znalost']
|
||||||
|
|
||||||
|
def has_add_permission(self, req, obj): return False
|
||||||
|
|
||||||
|
|
||||||
class SeznamAdmin(VersionAdmin):
|
class SeznamAdmin(VersionAdmin):
|
||||||
""" Admin pro :py:class:`Seznam <prednasky.models.Seznam>` """
|
""" Admin pro :py:class:`Seznam <prednasky.models.Seznam>` """
|
||||||
list_display = ['soustredeni', 'stav']
|
list_display = ['soustredeni', 'stav']
|
||||||
inlines = [Seznam_PrednaskaInline]
|
inlines = [Seznam_PrednaskaInline, Seznam_ZnalostInline]
|
||||||
|
|
||||||
admin.site.register(Seznam, SeznamAdmin)
|
admin.site.register(Seznam, SeznamAdmin)
|
||||||
|
|
||||||
|
|
|
@ -49,4 +49,5 @@ lorem
|
||||||
|
|
||||||
sphinx
|
sphinx
|
||||||
sphinx_rtd_theme
|
sphinx_rtd_theme
|
||||||
|
sphinxcontrib-django
|
||||||
myst_parser
|
myst_parser
|
||||||
|
|
Loading…
Reference in a new issue