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

Mark message as HTML safe in templates #942

Closed
wants to merge 1 commit into from

Conversation

atodorov
Copy link
Contributor

@atodorov atodorov commented May 1, 2020

will allow using messages which contain HTML tags like links.

Fixes kiwitcms/Kiwi#964

will allow using messages which contain HTML tags like links.

Fixes kiwitcms/Kiwi#964
@sehmaschine
Copy link
Owner

Thanks for the PR, but I'm not sure about this since Django doesn't allow for safe messages as well. There might be a (good) reason it is not allowed?

@atodorov
Copy link
Contributor Author

atodorov commented May 1, 2020

Django doesn't allow for safe messages as well

I'm not sure what do you mean here? I do have my application stuffing a bunch of HTML in the message and on the admin pages it sadly doesn't render nicely.

There might be a (good) reason it is not allowed?

Sure, if you aren't careful that's XSS waiting to happen at the very least.

I don't see an obvious way to mark the message as safe when it comes from the backend though.

@sehmaschine
Copy link
Owner

@atodorov
Copy link
Contributor Author

atodorov commented May 2, 2020

I've found django.utils.safestring.mark_safe() which allows me to handle this on the app side.

@atodorov atodorov closed this May 2, 2020
@atodorov atodorov deleted the show_html_in_messages branch May 2, 2020 19:13
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

Successfully merging this pull request may close these issues.

HTML tags displayed when changing base URL
2 participants