From 4ebf3d8a0e35251bd8c73d388928465297bbedb7 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Wed, 10 Jul 2019 12:32:04 +0100 Subject: [PATCH] Bring back TinyMCE for editing flatpages --- flatpages/views.py | 4 ++-- localsettingsdocker.py | 8 ++++---- localsettingsserver.py | 4 ++-- templates/editflatpage.html | 5 +++++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/flatpages/views.py b/flatpages/views.py index 6360393..6ef2404 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -38,7 +38,7 @@ def flatpage(request, path): print("flat path noinfo", path) return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path) - if path.endswith("/") or path == "": + if path.endswith("/") or path == "": try: o = open(os.path.normpath(settings.EXPOWEB + path + "index.html"), "rb") path = path + "index.html" @@ -165,4 +165,4 @@ def editflatpage(request, path): class FlatPageForm(forms.Form): title = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - html = forms.CharField(widget=forms.Textarea()) + html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 20})) diff --git a/localsettingsdocker.py b/localsettingsdocker.py index aa7e7a9..bc7d8cb 100644 --- a/localsettingsdocker.py +++ b/localsettingsdocker.py @@ -47,13 +47,13 @@ MEDIA_URL = URL_ROOT + DIR_ROOT + 'site_media/' MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/' MEDIA_ADMIN_DIR = '/usr/lib/python2.7/site-packages/django/contrib/admin/media/' -STATIC_URL = URL_ROOT -STATIC_ROOT = DIR_ROOT +STATIC_URL = "/static/" +STATIC_ROOT = "/expo/static" JSLIB_URL = URL_ROOT + 'javascript/' -TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' -TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + '/tinymce_media/' +TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/' +TINY_MCE_MEDIA_URL = STATIC_ROOT + '/tiny_mce/' TEMPLATE_DIRS = ( PYTHON_PATH + "templates", diff --git a/localsettingsserver.py b/localsettingsserver.py index 1d8fbe7..259974e 100644 --- a/localsettingsserver.py +++ b/localsettingsserver.py @@ -52,8 +52,8 @@ MEDIA_ADMIN_DIR = '/usr/lib/python2.7/site-packages/django/contrib/admin/media/' JSLIB_URL = URL_ROOT + 'javascript/' -TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' -TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + 'tinymce_media/' +TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/' +TINY_MCE_MEDIA_URL = STATIC_ROOT + '/tiny_mce/' TEMPLATE_DIRS = ( PYTHON_PATH + "templates", diff --git a/templates/editflatpage.html b/templates/editflatpage.html index 4768078..de09b4e 100644 --- a/templates/editflatpage.html +++ b/templates/editflatpage.html @@ -3,6 +3,11 @@ {% block extrahead %} {% load csrffaker %} + {% endblock %} {% block body %}

Edit {{ path }}