About
django3-flatpages-tinymce provides on-site editing of "Flat Pages" with minimal impact on the rest of code. This is a fork of the original, dropping support for python 2 and django < 3.0.
django3-flatpages-tinymce is available under the MIT license.
Usage
First of all, you need to have django3-flatpages-tinymce and django-tinymce installed; for your convenience, recent versions should be available from PyPI.
pip install django-tinymce django3-flatpages-tinymce
To use, just add these applications to your INSTALLED_APPS after django.contrib.flatpages app:
INSTALLED_APPS = (
...
'django.contrib.staticfiles',
'django.contrib.flatpages',
...
'tinymce',
'flatpages_tinymce',
)
As instructed by the flatpages guide, add this to your MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES = (
...
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)
Remember that this little addition to your urls.py is required by django-tinymce:
urlpatterns = patterns('',
...
path('tinymce/', include('tinymce.urls')),
...
)
Finally create the tables for flatpages and install the JS/CSS files using
./manage.py nugrate
./manage.py collectstatic
If you want on-site editing of templates, you must edit flatpages templates: change {{flatpage.content} to {% flatpage_admin flatpage %} from flatpage_admin template library. So
{% extends "base.html" %}
{% block body %}
{% endblock %}
{% block body %}
<h1>{{flatpage.title}}</h1>
{{flatpage.content}}
{% endblock %}
will become
{% extends "base.html" %}
{% load flatpage_admin %}
{% block body %}
<h1>{{flatpage.title}}</h1>
{% flatpage_admin flatpage %]
{% endblock %}
If you are bothered with <script>/<link> tags, being inserted in <body> tag and your template has something like {% block extrahead %}, you can move all plugin media in head, using {% flatpage_media %} tag.
{% extends "base.html" %}
{% block extrahead %}
{% flatpage_media %}
{% endblock %}
{% block body %}
<h1>{{flatpage.title}}</h1>
{% flatpage_admin flatpage %}
{% endblock %}
Settings
Default settings are in flatpages_tinymce.settings.py file. Also, you can override them in site-wide settings.py file. The main of them are:
- FLATPAGES_TINYMCE_ADMIN (default True) - use TinyMCE widget in admin area
- FLATPAGES_TINYMCE_FRONTEND (default True) - use TinyMCE widget in frontend
- FLATPAGES_TEMPLATE_DIR (default: TEMPLATE_DIRS[0] + 'flatpages') - directory where flatpages templates are placed
- FLATPAGES USE_MINIFIED (defalut: not settings.DEBUG) - use minified versions of JS/CSS
Further, you will want to change default settings of TinyMCE Editor.
TINYMCE_DEFAULT_CONFIG = {
# custom plugins
'plugins': "table,spellchecker,paste,searchreplace",
# editor theme
'theme': "advanced",
# custom CSS file for styling editor area
'content_css': MEDIA_URL + "css/custom_tinymce.css",
# use absolute urls when inserting links/images
'relative_urls': False,
}
Changes
Changes in version 0.2
- Ported to support Django > 3 and Python 3
- drop support for Russian
Changes in version 0.1
- First public release.
Metadata
Release files for django3-flatpages-tinymce 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django3-flatpages-tinymce-0.2.2.tar.gz | 9.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django3_flatpages_tinymce-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.7 kB
Release files / django3-flatpages-tinymce-0.2.2.tar.gz
| Download URL | django3-flatpages-tinymce-0.2.2.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e584031950c1b76a1f5935d8f49897f6f9425b331ee667365b7e001ea425ed68
|
|
BLAKE2b-256 checksum How to use checksums |
ddcd70713a34649c2a24b497aebe7267e184cd9fbb411ac4921d9d082a16bf56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.2 Linux/4.15.0-142-generic
|
Release files / django3_flatpages_tinymce-0.2.2-py3-none-any.whl
| Download URL | django3_flatpages_tinymce-0.2.2-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e34dce928e2df2f735a57e7f0df3f1eae6f575e1393027937fcb60b444c2be92
|
|
BLAKE2b-256 checksum How to use checksums |
84730361741a5a1ca578790008360b00f3ba75cb762fd8732f80ef7839fd9512
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.2 Linux/4.15.0-142-generic
|
Security for django3-flatpages-tinymce 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.