Browse Source

CKEditory umožňují upload obrázků

middleware_test
LEdoian 6 years ago
parent
commit
eb265b6fb8
  1. 4
      mamweb/admin.py
  2. 16
      seminar/admin.py

4
mamweb/admin.py

@ -6,10 +6,10 @@ from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms from django import forms
from ckeditor.widgets import CKEditorWidget from ckeditor_uploader.widgets import CKEditorUploadingWidget
class FlatpageForm(FlatpageFormOld): class FlatpageForm(FlatpageFormOld):
content = forms.CharField(widget=CKEditorWidget()) content = forms.CharField(widget=CKEditorUploadingWidget())
class Meta: class Meta:
model = FlatPage # this is not automatically inherited from FlatpageFormOld model = FlatPage # this is not automatically inherited from FlatpageFormOld
exclude = [] exclude = []

16
seminar/admin.py

@ -5,7 +5,7 @@ from django import forms
from django.forms import widgets from django.forms import widgets
from reversion.admin import VersionAdmin from reversion.admin import VersionAdmin
from solo.admin import SingletonModelAdmin from solo.admin import SingletonModelAdmin
from ckeditor.widgets import CKEditorWidget from ckeditor_uploader.widgets import CKEditorUploadingWidget
from django.db.models import Count from django.db.models import Count
from django.db import models from django.db import models
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
@ -402,9 +402,9 @@ from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget
class ProblemAdminForm(forms.ModelForm): class ProblemAdminForm(forms.ModelForm):
text_zadani = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_zadani')) text_zadani = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Problem, 'text_zadani'))
text_reseni = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_reseni')) text_reseni = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Problem, 'text_reseni'))
text_org = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_org')) text_org = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Problem, 'text_org'))
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False) zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False)
autor = UserModelChoiceField(User.objects.filter(is_staff=True)) autor = UserModelChoiceField(User.objects.filter(is_staff=True))
opravovatel = UserModelChoiceField(User.objects.filter(is_staff=True), required=False) opravovatel = UserModelChoiceField(User.objects.filter(is_staff=True), required=False)
@ -536,9 +536,9 @@ create_modeladmin(ProblemZadanyAdmin, Problem, 'ProblemZadany', verbose_name=u'P
### Prispevek (k tematkum) ### Prispevek (k tematkum)
class PrispevekAdminForm(forms.ModelForm): class PrispevekAdminForm(forms.ModelForm):
text_org = forms.CharField(widget=CKEditorWidget(), required=False, text_org = forms.CharField(widget=CKEditorUploadingWidget(), required=False,
**field_labels(Prispevek, 'text_org')) **field_labels(Prispevek, 'text_org'))
text_resitel = forms.CharField(widget=CKEditorWidget(), required=False, text_resitel = forms.CharField(widget=CKEditorUploadingWidget(), required=False,
**field_labels(Prispevek, 'text_resitel')) **field_labels(Prispevek, 'text_resitel'))
class Meta: class Meta:
@ -554,7 +554,7 @@ admin.site.register(Prispevek, PrispevekAdmin)
### Soustredeni ### Soustredeni
class SoustredeniAdminForm(forms.ModelForm): class SoustredeniAdminForm(forms.ModelForm):
text = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Soustredeni, 'text')) text = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Soustredeni, 'text'))
class Meta: class Meta:
model = Soustredeni model = Soustredeni
exclude = [] exclude = []
@ -595,7 +595,7 @@ admin.site.register(Konfera,KonferaAdmin)
### Novinky ### Novinky
class NovinkyAdminForm(forms.ModelForm): class NovinkyAdminForm(forms.ModelForm):
text = forms.CharField(widget=CKEditorWidget(), required=False, text = forms.CharField(widget=CKEditorUploadingWidget(), required=False,
**field_labels(Novinky, 'text')) **field_labels(Novinky, 'text'))
autor = UserModelChoiceField(User.objects.filter(is_staff=True)) autor = UserModelChoiceField(User.objects.filter(is_staff=True))

Loading…
Cancel
Save