Skip to content

Commit

Permalink
updated docs + test_parser
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpoi committed Dec 27, 2024
1 parent 6796fae commit 8ffd844
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ You can use relative path from your `templates` folder or absolute file path.
Example: This is a simple mail created by #generator#
- If you have more than 1 language configured you will be able to fill values for all languages in `LANGUAGES`:

- Create element in inline with desired language
- Create element in Email Template Contents inline with desired language
- Click `Save and Continue Editing`
- Fill in placeholders

- Save your instance.
- You can now send test email with created object using `Send test email button`.
In test email you can make use of `demo context` that can be refreshed using `Reparse Context` button.
- To send an email with the created template:

```python
Expand Down
1 change: 1 addition & 0 deletions demoapp/templates/test/nested_jsons.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{{ controller.subtopic }}
{% for upd in new.changes %}
{{ controller.subsubtopic }}
{{ upd.timestamp }}
{% endfor %}
{{ new.interactions }}
{{ new.extra_values.reposts }}
Expand Down
6 changes: 6 additions & 0 deletions demoapp/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def test_parse_nested_objects():
},
'updates': [
{
'changes':[
{
'timestamp': ''
}
],

'extra_values': {
'reposts': '',
},
Expand Down
5 changes: 4 additions & 1 deletion docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,15 @@ You can use relative path from your ``templates`` folder or absolute file path.

- If you have more than 1 language configured you will be able to fill values for all languages in ``LANGUAGES``.

- Create element in inline with desired language
- Create element in Email Template Content inline with desired language
- Click `Save and Continue Editing`
- Fill in placeholders

- Save your instance.

- You can now send test email with created object using ``Send test email button``.
In test email you can make use of ``demo context`` that can be refreshed using ``Reparse Context`` button.

- To send an email with the created template:

.. code-block:: python
Expand Down
15 changes: 8 additions & 7 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ When needed base file was created, users can create 2-phase templates using it.

1. Open admin interface and click create new EmailMergeModel.
2. Enter a name which will be used as an template alias for sending.
3. Click "Save and continue editing" (This event is also triggered when a base file is changing)
3. Click "Save and continue editing" (This event is also triggered when a template file is changing)
4. Forms for placeholders editing will appear with defaults, such as:

Placeholder: <name>, Language: <lang_code>
Expand Down Expand Up @@ -617,17 +617,18 @@ Alternatively to calling send you can enqueue emails directly from admin interfa
For this you can create RecipientLists, which are just named lists of EmailAddress objects.

As soon as your RecipientList is created you can create and send your Newsletter.
For this simply:

- Open your admin interface and select template if you want to use one. Note, that template is mutually exclusive with subject, message and HTML message.
For this simply create new Newsletter object:

- Click "Save and Continue". Your context will be populated with variables found in template and placeholders.
- Set name, RecipientList and choose EmailMerge to be used.

.. note::
Sendmail has its own context parser. To use it simply click ``Reparse Context`` button,
you should reparse it everytime you change the EmailMerge.

User variable (``{{var}}``) in template wont be correctly found if its name contains ``.`` and it is outside ``{% for %}`` tag.
- Parser will generate the structure of expected context, you can then fill values or add objects to the list.

- Fill in values for your context keys. Note, you wont see recipient context keys, because those are filled automatically for each recipient.
.. note::
Note, you wont see recipient context keys, because those are filled automatically for each recipient.

- You can specify other optional parameters which will be passed to each created email.

Expand Down

0 comments on commit 8ffd844

Please sign in to comment.