Issue
How do I embed html code here. I tried using mark_safe, it didn't work
class PostCreateView(SuccessMessageMixin, LoginRequiredMixin, CreateView):
model = Post
form_class = PostForm
template_name = 'blogApp/create.html'
success_url = '/'
success_message = mark_safe(
'<strong>%(title)s</strong> Created Successfully')
Thank you in advance
Solution
You can try this:
success_message = "<h1>hello</h1>"
Now in your html, where you are rendering messages
put a safe filter like this:
{{message|safe}}
Answered By - Nitin Raturi Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.