On 18/04/2018 6:51 AM, Andréas Kühne wrote:
Hi all,

I am hoping that someone has stumbled across a solution to a problem that I have currently.

I have created an email templating system. Each template can contain placeholders that will be replaced with live data (a bit like the django templating system). When I store the templates they are stored in HTML.

Now when I send the emails I of course want to send both text content and HTML. My idea from the beginning was to take my HTML content and strip the HTML tags and then send that. I did this via the django utils that strip tags. Now this works, HOWEVER I don't get any newlines for my <br> and <p></p> tags.

I was wondering if anyone has had any similar issues and has found a good solution? What I want to do is strip all of the html tags and at the same time replace the <br> and <p></p> tags.

I made a special template tag where I encountered a similar problem but it wouldn't suit your use case. I had to deal with newlines inserted by users and which needed to be removed.

Maybe you could decorate the Django method and replace the newline tags with something unique before Django strips the tags. Then replace your unique replacements with \n after Django returns the text.

Just a thought.



Regards,

Andréas
--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCdiDvmZEgb-wUuZwhh5t011ij%3Dbi4co6MaERmSLkpgaaw%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CAK4qSCdiDvmZEgb-wUuZwhh5t011ij%3Dbi4co6MaERmSLkpgaaw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e38a6e33-e0d3-fee4-eb30-e2970040c5c2%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to