Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendered preview in admin #325

Open
wolph opened this issue Jul 31, 2020 · 8 comments
Open

Rendered preview in admin #325

wolph opened this issue Jul 31, 2020 · 8 comments

Comments

@wolph
Copy link

wolph commented Jul 31, 2020

In my fork of the project I have a rendered preview of the email which is a really useful feature if you ask me. It shows both the text and html variant of the mail in an iframe within the admin.

Would this be an interesting addition for the project?

The changes needed:

  1. A example_context field added to the EmailTemplate model
  2. A few admin changes: master...WoLpH:master#diff-43bb3346d5574d3cfa6043e724bcc7f7

I can work on making a clean pull request if this is something that would be merged :)

@jrief
Copy link
Collaborator

jrief commented Aug 2, 2020

You mean something like this?

This will be available in the next major release, presumable 3.5

@wolph
Copy link
Author

wolph commented Aug 2, 2020

Yes. That's very similar 👍

@wolph wolph closed this as completed Aug 2, 2020
@wolph wolph reopened this Nov 15, 2020
@wolph
Copy link
Author

wolph commented Nov 15, 2020

@jrief I'm reopening this because that feature is similar but not nearly as useful as the one I'm proposing here :)

It currently only shows the rendered version of sent emails. My code shows how an email template will look for both HTML and text before you send it using example context passed along as JSON data. Additionally, it also shows the variants in all other languages if available.

@jrief
Copy link
Collaborator

jrief commented Nov 15, 2020

I see! So basically you show how future emails will be get rendered, while my former pull request show how sent emails have been rendered. Yes, I believe inside the post_office template view, this could be quite useful. Do you have a screenshot of that feature?

@wolph
Copy link
Author

wolph commented Nov 16, 2020

This is how it currently looks. The only data model change it requires (I think) is the addition of a json field to specify the template variables.

I'm using iframes with separate requests for the rendering. The advantage of this method is that if you have a template syntax error or something it won't break the admin page

image

@wolph
Copy link
Author

wolph commented Nov 16, 2020

You can see the current diff here: master...WoLpH:master

@jrief
Copy link
Collaborator

jrief commented Nov 16, 2020

This feature would really be useful for drafting email templates.

@wolph
Copy link
Author

wolph commented Nov 16, 2020

Should I prepare a clean pull request in that case?
Any changes you would like in the workings?

wolph added a commit to wolph/django-post_office that referenced this issue Dec 12, 2021
wolph added a commit to wolph/django-post_office that referenced this issue Dec 12, 2021
wolph added a commit to wolph/django-post_office that referenced this issue Dec 12, 2021
wolph added a commit to wolph/django-post_office that referenced this issue Dec 12, 2021
wolph added a commit to wolph/django-post_office that referenced this issue Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants