From 5fa07c3bc9622e65e31f454c69da9e09214c967f Mon Sep 17 00:00:00 2001
From: Mykhailo Poienko <22IMC10258@fh-krems.ac.at>
Date: Wed, 23 Oct 2024 14:25:29 +0200
Subject: [PATCH] internalization issues
---
README.md | 12 +++++
demoapp/settings.py | 2 +-
demoapp/templates/email/default.html | 70 ++++++++++++++++++++++++++++
demoapp/tests/test_01_mail.py | 2 +-
demoapp/urls.py | 1 +
docs/source/installation.rst | 9 ++++
docs/source/quickstart.rst | 4 +-
docs/source/usage.rst | 6 +++
sendmail/admin.py | 2 +-
sendmail/models.py | 1 +
sendmail/settings.py | 7 ++-
sendmail/utils.py | 2 +-
sendmail/version.txt | 2 +-
setup.py | 2 +-
14 files changed, 113 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index dc72db7c..634856cf 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,16 @@ Add `CKEDITOR_UPLOAD_PATH`. This path will be used to store ckeditor uploaded im
CKEDITOR_UPLOAD_PATH = 'ckeditor_uploads'
```
+To your main `urls.py` add `ckeditor_uploader` urls:
+
+```python
+urlpatterns = [
+ ...,
+ path('ckeditor/', include('ckeditor_uploader.urls')),
+ ]
+```
+
+
Add `STATIC_URL` and `STATIC_ROOT`
```python
@@ -164,6 +174,8 @@ SENDMAIL = {
You can use relative path from your `templates` folder or absolute file path.
+- Specify list of translation languages in `settings.LANGUAGES` or disable internalization by setting `settings.USE_I18N` to `False`.
+
- Open your admin interface and create a new EmailMergeModel instance:
- Enter name. This will be used as identifier for your template and click “Save and continue editing”.
- Select Base File which you have created.
diff --git a/demoapp/settings.py b/demoapp/settings.py
index 42420bb9..e408e0e5 100644
--- a/demoapp/settings.py
+++ b/demoapp/settings.py
@@ -223,7 +223,7 @@
TIME_ZONE = "UTC"
-USE_I18N = True
+USE_I18N = False
USE_L10N = True
diff --git a/demoapp/templates/email/default.html b/demoapp/templates/email/default.html
index e69de29b..56921b5d 100644
--- a/demoapp/templates/email/default.html
+++ b/demoapp/templates/email/default.html
@@ -0,0 +1,70 @@
+{% load sendmail %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+ {% placeholder 'header' %}
+ |
+
+
+
+
+
+ Dear
+ {% with gender=recipient.gender %}
+ {% if gender == 'male' %}
+ Mr.
+ {% elif gender == 'female' %}
+ Ms.
+ {% else %}
+ Human
+ {% endif %}
+ {% endwith %}
+ {% placeholder 'name' %}
+
+ {% placeholder 'main' %}
+ |
+
+
+
+
+
+ {% placeholder 'footer' %}
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
\ No newline at end of file
diff --git a/demoapp/tests/test_01_mail.py b/demoapp/tests/test_01_mail.py
index 97f497ba..3697edd7 100644
--- a/demoapp/tests/test_01_mail.py
+++ b/demoapp/tests/test_01_mail.py
@@ -445,7 +445,7 @@ def test_internalization(caplog, template):
recipients=[en_recipient, de_recipient, ua_recipient, nullable_recipient],
template=template)
- assert 'Language "ua" is not found in LANGUAGES configuration.' in caplog.text
+ assert 'Language "ua" is not found in LANGUAGES configuration' in caplog.text
assert len(emails) == 4
assert emails[0].language == 'en'
diff --git a/demoapp/urls.py b/demoapp/urls.py
index a08e7965..d571271b 100644
--- a/demoapp/urls.py
+++ b/demoapp/urls.py
@@ -6,6 +6,7 @@
urlpatterns = [
path('admin/', admin.site.urls),
+ path('ckeditor/', include('ckeditor_uploader.urls')),
]
if settings.DEBUG:
diff --git a/docs/source/installation.rst b/docs/source/installation.rst
index 205f3ec5..57bce60c 100644
--- a/docs/source/installation.rst
+++ b/docs/source/installation.rst
@@ -52,6 +52,15 @@ Add ``CKEDITOR_UPLOAD_PATH``. This path will be used to store ckeditor uploaded
CKEDITOR_UPLOAD_PATH = 'ckeditor_uploads'
+To your main ``urls.py`` add ``ckeditor_uploader`` urls.
+
+.. code-block::
+
+ urlpatterns = [
+ ...
+ path('ckeditor/', include('ckeditor_uploader.urls')),
+ ]
+
Add ``STATIC_URL`` and ``STATIC_ROOT``
.. code-block::
diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst
index 297455b7..657b6b88 100644
--- a/docs/source/quickstart.rst
+++ b/docs/source/quickstart.rst
@@ -35,7 +35,7 @@ If you want to use templates: