On migre à CKEditor5
This commit is contained in:
parent
bc19358ed3
commit
a26d81a74a
@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe
|
|||||||
from django.template.defaultfilters import slugify
|
from django.template.defaultfilters import slugify
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from colorfield.fields import ColorField
|
from colorfield.fields import ColorField
|
||||||
from ckeditor.fields import RichTextField
|
from django_ckeditor_5.fields import CKEditor5Field
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import os
|
import os
|
||||||
@ -46,8 +46,9 @@ class StaticContent(models.Model):
|
|||||||
max_length=512,
|
max_length=512,
|
||||||
unique=True,
|
unique=True,
|
||||||
)
|
)
|
||||||
text = RichTextField(
|
text = CKEditor5Field(
|
||||||
verbose_name=_("Content"), help_text=_("Text as shown to the visitors")
|
verbose_name=_("Content"), help_text=_("Text as shown to the visitors"),
|
||||||
|
blank=True
|
||||||
)
|
)
|
||||||
url_path = models.CharField(
|
url_path = models.CharField(
|
||||||
verbose_name=_("URL path"),
|
verbose_name=_("URL path"),
|
||||||
@ -450,7 +451,7 @@ class Event(models.Model):
|
|||||||
first = self.start_day
|
first = self.start_day
|
||||||
last = self.get_consolidated_end_day()
|
last = self.get_consolidated_end_day()
|
||||||
calendar = CalendarList(first, last, exact=True)
|
calendar = CalendarList(first, last, exact=True)
|
||||||
return [(len(d.events), d.date) for dstr, d in calendar.calendar_days.items()]
|
return [(len(d.events), d.date) for dstr, d in calendar.get_calendar_days().items()]
|
||||||
|
|
||||||
def is_single_day(self, intuitive=True):
|
def is_single_day(self, intuitive=True):
|
||||||
return self.start_day == self.get_consolidated_end_day(intuitive)
|
return self.start_day == self.get_consolidated_end_day(intuitive)
|
||||||
@ -1201,7 +1202,7 @@ class ContactMessage(models.Model):
|
|||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
)
|
)
|
||||||
message = RichTextField(verbose_name=_("Message"), help_text=_("Your message"))
|
message = CKEditor5Field(verbose_name=_("Message"), help_text=_("Your message"), blank=True)
|
||||||
|
|
||||||
date = models.DateTimeField(auto_now_add=True)
|
date = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
@ -1212,7 +1213,7 @@ class ContactMessage(models.Model):
|
|||||||
),
|
),
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
comments = RichTextField(
|
comments = CKEditor5Field(
|
||||||
verbose_name=_("Comments"),
|
verbose_name=_("Comments"),
|
||||||
help_text=_("Comments on the message from the moderation team"),
|
help_text=_("Comments on the message from the moderation team"),
|
||||||
default="",
|
default="",
|
||||||
|
@ -47,7 +47,7 @@ INSTALLED_APPS = [
|
|||||||
"django_better_admin_arrayfield",
|
"django_better_admin_arrayfield",
|
||||||
"django_filters",
|
"django_filters",
|
||||||
"compressor",
|
"compressor",
|
||||||
"ckeditor",
|
"django_ckeditor_5",
|
||||||
"recurrence",
|
"recurrence",
|
||||||
"location_field.apps.DefaultConfig",
|
"location_field.apps.DefaultConfig",
|
||||||
"django.contrib.postgres",
|
"django.contrib.postgres",
|
||||||
@ -74,13 +74,12 @@ MIDDLEWARE = [
|
|||||||
# "django.middleware.cache.FetchFromCacheMiddleware",
|
# "django.middleware.cache.FetchFromCacheMiddleware",
|
||||||
]
|
]
|
||||||
|
|
||||||
CKEDITOR_CONFIGS = {
|
CKEDITOR_5_CONFIGS = {
|
||||||
"default": {
|
'default': {
|
||||||
"toolbar": "full",
|
'toolbar': ['heading', '|', 'bold', 'italic', 'link', '|',
|
||||||
"removePlugins": "stylesheetparser",
|
'bulletedList', 'numberedList', 'blockQuote',],
|
||||||
"allowedContent": True,
|
'language': 'fr',
|
||||||
},
|
},}
|
||||||
}
|
|
||||||
|
|
||||||
ROOT_URLCONF = "agenda_culturel.urls"
|
ROOT_URLCONF = "agenda_culturel.urls"
|
||||||
|
|
||||||
|
@ -2,14 +2,6 @@
|
|||||||
|
|
||||||
{% block title %}{% block og_title %}Modifier {{ object.name }}{% endblock %}{% endblock %}
|
{% block title %}{% block og_title %}Modifier {{ object.name }}{% endblock %}{% endblock %}
|
||||||
|
|
||||||
{% block entete_header %}
|
|
||||||
{% load static %}
|
|
||||||
<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>
|
|
||||||
<script type="text/javascript" src="{% static "ckeditor/ckeditor-init.js" %}"></script>
|
|
||||||
<script type="text/javascript" src="{% static "ckeditor/ckeditor/ckeditor.js" %}"></script>
|
|
||||||
<script src="/static/admin/js/vendor/jquery/jquery.js"></script>
|
|
||||||
<script src="/static/admin/js/jquery.init.js"></script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
@ -19,5 +11,6 @@
|
|||||||
{{ form.as_p }}
|
{{ form.as_p }}
|
||||||
<input type="submit" value="Enregistrer">
|
<input type="submit" value="Enregistrer">
|
||||||
</form>
|
</form>
|
||||||
|
{{ form.media }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -173,6 +173,7 @@ urlpatterns = [
|
|||||||
name="export_ical"),
|
name="export_ical"),
|
||||||
re_path(r'^robots\.txt', include('robots.urls')),
|
re_path(r'^robots\.txt', include('robots.urls')),
|
||||||
path("__debug__/", include("debug_toolbar.urls")),
|
path("__debug__/", include("debug_toolbar.urls")),
|
||||||
|
path("ckeditor5/", include('django_ckeditor_5.urls')),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
@ -32,6 +32,7 @@ django-filter==23.3
|
|||||||
django-compressor==4.4
|
django-compressor==4.4
|
||||||
django-libsass==0.9
|
django-libsass==0.9
|
||||||
django-ckeditor==6.7.1
|
django-ckeditor==6.7.1
|
||||||
|
django-ckeditor-5==0.2.13
|
||||||
django-recurrence==1.11.1
|
django-recurrence==1.11.1
|
||||||
icalendar==5.0.11
|
icalendar==5.0.11
|
||||||
lxml==5.1.0
|
lxml==5.1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user