Skip to content

Commit

Permalink
Replace wyswyg (#57)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Salaah01 and Salaah01 committed Mar 5, 2024
1 parent 9d2119e commit 546ad34
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 52 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
]
```
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions email_signals/migrations/0004_alter_signal_html_email.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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"
),
),
Expand Down
4 changes: 2 additions & 2 deletions email_signals/migrations/0005_auto_20211204_1258.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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"
),
),
Expand Down
10 changes: 6 additions & 4 deletions email_signals/migrations/0007_alter_signal_mailing_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
),
),
]
4 changes: 2 additions & 2 deletions email_signals/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion example/example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'email_signals',
'ckeditor',
'tinymce',
'sample_app',
]

Expand Down
1 change: 1 addition & 0 deletions example/example/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
urlpatterns = [
path('admin/', admin.site.urls),
path('email-signals/', include('email_signals.urls')),
path("tinymce/", include("tinymce.urls"))
]
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down
59 changes: 31 additions & 28 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,82 +1,85 @@
#
# 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
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
Expand Down
6 changes: 2 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Django >= 3.2
django-tinymce >= 3.7.1

0 comments on commit 546ad34

Please sign in to comment.