From 3d035b994abc69c678ca32a99932b15747ffadc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 19 Nov 2024 20:22:12 +0100 Subject: [PATCH] =?UTF-8?q?P=C5=99id=C3=A1n=C3=AD=20CKEditoru=20do=20Soust?= =?UTF-8?q?=C5=99ed=C4=9Bn=C3=AD=20a=20Novinek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- novinky/admin.py | 17 ++++++++++++++++- soustredeni/admin.py | 13 ++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/novinky/admin.py b/novinky/admin.py index ea822bca..eecef739 100644 --- a/novinky/admin.py +++ b/novinky/admin.py @@ -1,5 +1,20 @@ +import django.forms from django.contrib import admin +from ckeditor_uploader.widgets import CKEditorUploadingWidget + from .models import Novinky -admin.site.register(Novinky) + +class NovinkyAdminForm(django.forms.ModelForm): + class Meta: + model = Novinky + widgets = { + 'text': CKEditorUploadingWidget, + } + fields = '__all__' + +@admin.register(Novinky) +class NovinkyAdmin(admin.ModelAdmin): + form = NovinkyAdminForm + diff --git a/soustredeni/admin.py b/soustredeni/admin.py index 048b9ec3..2f84eb59 100644 --- a/soustredeni/admin.py +++ b/soustredeni/admin.py @@ -1,7 +1,10 @@ +import django.forms from django.contrib import admin from django.forms import widgets from django.db import models +from ckeditor_uploader.widgets import CKEditorUploadingWidget + import soustredeni.models as m @@ -35,9 +38,17 @@ class SoustredeniOrganizatoriInline(admin.TabularInline): return qs.select_related('organizator', 'soustredeni') +class SoustredeniAdminForm(django.forms.ModelForm): + class Meta: + model = m.Soustredeni + widgets = { + 'text': CKEditorUploadingWidget, + } + fields = '__all__' + @admin.register(m.Soustredeni) class SoustredeniAdmin(admin.ModelAdmin): - model = m.Soustredeni + form = SoustredeniAdminForm inline_type = 'tabular' inlines = [SoustredeniUcastniciInline, SoustredeniOrganizatoriInline]