From 546ad340d9251775c740326b7ae75abdd321b967 Mon Sep 17 00:00:00 2001 From: Salaah Amin <48691708+Salaah01@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:51:35 +0000 Subject: [PATCH] Replace wyswyg (#57) * updated readme * replaced ckeditor with new tinymce * updated example * updated README * updated requirements * updated package deps. * linting * removed support for py3.7 * updated version in setup.cfg --------- Co-authored-by: Salaah Amin --- README.md | 11 ++-- .../0004_alter_signal_html_email.py | 4 +- .../migrations/0005_auto_20211204_1258.py | 4 +- .../0007_alter_signal_mailing_list.py | 10 ++-- email_signals/models.py | 4 +- example/example/settings.py | 2 +- example/example/urls.py | 1 + requirements.in | 2 +- requirements.txt | 59 ++++++++++--------- setup.cfg | 6 +- tox.ini | 6 +- 11 files changed, 57 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 679792b..b8459f9 100644 --- a/README.md +++ b/README.md @@ -101,25 +101,25 @@ git clone https://github.com/Salaah01/django-email-signals.git ## Setup **1. Add to `INSTALLED_APPS`** -i. Add Add `ckeditor` to your `INSTALLED_APPS` in your `settings.py` file. +i. Add Add `tinymce` to your `INSTALLED_APPS` in your `settings.py` file. ```python INSTALLED_APPS = [ 'app_1`, 'app_2`, '...', - 'ckeditor', + 'tinymce', ] ``` -ii. Add Add `email_signals` to your `INSTALLED_APPS` in your `settings.py` file. This should be added after any apps which contain models for which you would like to create signals using this application. +ii. Add `email_signals` to your `INSTALLED_APPS` in your `settings.py` file. This should be added after any apps which contain models for which you would like to create signals using this application. ```python INSTALLED_APPS = [ 'app_1`, 'app_2`, '...', - 'ckeditor', + 'tinymce', 'email_signals` ] ``` @@ -130,13 +130,14 @@ python manage.py migrate python manage.py collectstatic ``` -**3. Update URLs (Option)** +**3. Update URLs (Optional)** Update your root `urls.py` file to include the following: ```python from django.urls import include url_patterns = [ path('email-signals/', include('email_signals.urls')), + path('tinymce/', include('tinymce.urls')), ] ``` We recommend changing the URL to something a bit harder to guess, just to make life harder for those pesky snoopers. The application paths all require the user to be a staff member to be able to access the links. diff --git a/email_signals/migrations/0004_alter_signal_html_email.py b/email_signals/migrations/0004_alter_signal_html_email.py index 9bc21bb..b3297b1 100644 --- a/email_signals/migrations/0004_alter_signal_html_email.py +++ b/email_signals/migrations/0004_alter_signal_html_email.py @@ -1,7 +1,7 @@ # Generated by Django 3.2.9 on 2021-12-04 02:51 -import ckeditor.fields from django.db import migrations +import tinymce.models class Migration(migrations.Migration): @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="signal", name="html_email", - field=ckeditor.fields.RichTextField( + field=tinymce.models.HTMLField( blank=True, null=True, verbose_name="HTML email" ), ), diff --git a/email_signals/migrations/0005_auto_20211204_1258.py b/email_signals/migrations/0005_auto_20211204_1258.py index 26ea5fd..d549d32 100644 --- a/email_signals/migrations/0005_auto_20211204_1258.py +++ b/email_signals/migrations/0005_auto_20211204_1258.py @@ -1,8 +1,8 @@ # Generated by Django 3.2.9 on 2021-12-04 12:58 -import ckeditor.fields from django.db import migrations, models import django.db.models.deletion +import tinymce.models class Migration(migrations.Migration): @@ -24,7 +24,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name="signal", name="html_message", - field=ckeditor.fields.RichTextField( + field=tinymce.models.HTMLField( blank=True, null=True, verbose_name="HTML content" ), ), diff --git a/email_signals/migrations/0007_alter_signal_mailing_list.py b/email_signals/migrations/0007_alter_signal_mailing_list.py index c7ac5a5..575ece8 100644 --- a/email_signals/migrations/0007_alter_signal_mailing_list.py +++ b/email_signals/migrations/0007_alter_signal_mailing_list.py @@ -6,13 +6,15 @@ class Migration(migrations.Migration): dependencies = [ - ('email_signals', '0006_auto_20211204_1335'), + ("email_signals", "0006_auto_20211204_1335"), ] operations = [ migrations.AlterField( - model_name='signal', - name='mailing_list', - field=models.TextField(help_text='The mailing list to send the signal to. Either enter a comma separated list of emails or the app will search for a function with the same name in the model instance.'), + model_name="signal", + name="mailing_list", + field=models.TextField( + help_text="The mailing list to send the signal to. Either enter a comma separated list of emails or the app will search for a function with the same name in the model instance." + ), ), ] diff --git a/email_signals/models.py b/email_signals/models.py index 29b1e80..022db3f 100644 --- a/email_signals/models.py +++ b/email_signals/models.py @@ -2,7 +2,7 @@ from django.db import models from django.db.models import signals from django.contrib.contenttypes.models import ContentType -from ckeditor.fields import RichTextField +from tinymce.models import HTMLField class EmailSignalMixin: @@ -58,7 +58,7 @@ class SignalTypeChoices(models.TextChoices): null=True, verbose_name="Plain text content", ) - html_message = RichTextField( + html_message = HTMLField( blank=True, null=True, verbose_name="HTML content", diff --git a/example/example/settings.py b/example/example/settings.py index 9ea28dc..240824c 100644 --- a/example/example/settings.py +++ b/example/example/settings.py @@ -39,7 +39,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'email_signals', - 'ckeditor', + 'tinymce', 'sample_app', ] diff --git a/example/example/urls.py b/example/example/urls.py index 1bb8ae8..5dc21d7 100644 --- a/example/example/urls.py +++ b/example/example/urls.py @@ -4,4 +4,5 @@ urlpatterns = [ path('admin/', admin.site.urls), path('email-signals/', include('email_signals.urls')), + path("tinymce/", include("tinymce.urls")) ] diff --git a/requirements.in b/requirements.in index 2249b1e..0be49cd 100644 --- a/requirements.in +++ b/requirements.in @@ -1,5 +1,5 @@ Django==3.2.14 -django-ckeditor==6.2.0 +django-tinymce==3.7.1 black==22.8.0 flake8==4.0.1 pip-tools==6.8.0 diff --git a/requirements.txt b/requirements.txt index c533f2a..af0b0f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,54 +1,52 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: # -# pip-compile requirements.in +# pip-compile # -asgiref==3.5.2 +asgiref==3.7.2 # via django black==22.8.0 # via -r requirements.in -build==0.8.0 +build==1.1.1 # via pip-tools -click==8.1.3 +click==8.1.7 # via # black # pip-tools -distlib==0.3.6 +distlib==0.3.8 # via virtualenv -django==3.2.15 +django==3.2.14 # via # -r requirements.in - # django-js-asset -django-ckeditor==6.2.0 + # django-tinymce +django-tinymce==3.7.1 # via -r requirements.in -django-js-asset==2.0.0 - # via django-ckeditor -filelock==3.8.0 +filelock==3.13.1 # via # tox # virtualenv flake8==4.0.1 # via -r requirements.in +importlib-metadata==7.0.1 + # via build mccabe==0.6.1 # via flake8 -mypy-extensions==0.4.3 +mypy-extensions==1.0.0 # via black -packaging==21.3 +packaging==23.2 # via # build # tox -pathspec==0.10.1 +pathspec==0.12.1 # via black -pep517==0.13.0 - # via build pip-tools==6.8.0 # via -r requirements.in -platformdirs==2.5.2 +platformdirs==4.2.0 # via # black # virtualenv -pluggy==1.0.0 +pluggy==1.4.0 # via tox py==1.11.0 # via tox @@ -56,27 +54,32 @@ pycodestyle==2.8.0 # via flake8 pyflakes==2.4.0 # via flake8 -pyparsing==3.0.9 - # via packaging -pytz==2022.2.1 +pyproject-hooks==1.0.0 + # via build +pytz==2024.1 # via django six==1.16.0 # via tox -sqlparse==0.4.2 +sqlparse==0.4.4 # via django tomli==2.0.1 # via # black # build + # pyproject-hooks # tox tox==3.26.0 # via -r requirements.in -typing-extensions==4.3.0 - # via black -virtualenv==20.16.5 +typing-extensions==4.10.0 + # via + # asgiref + # black +virtualenv==20.25.1 # via tox -wheel==0.38.0 +wheel==0.42.0 # via pip-tools +zipp==3.17.0 + # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/setup.cfg b/setup.cfg index e9184c5..83f7452 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,22 +14,20 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Topic :: Software Development :: Libraries :: Python Modules [options] -python_requires = >=3.6 +python_requires = >=3.8 packages = find: include_package_data = true zip_safe = false install_requires = django >= 3.0 - django-ckeditor >= 5.0.0 + django-tinymce >= 3.7.1 [options.packages.find] diff --git a/tox.ini b/tox.ini index 27a1fb8..44f1649 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] -envlist =py{37,38,39,310} +envlist =py{38,39,310} [testenv] deps = - Django >= 3.0 - django-ckeditor >= 5.0.0 \ No newline at end of file + Django >= 3.2 + django-tinymce >= 3.7.1 \ No newline at end of file