I'm creating an blog app in Django. In a form I'm using ckeditor in order to get the rich text format from the user. Now the data is saved in the database in the RTF with all tags. Now I want to retrieve data from database and display it to the user but unable to do so. In output data with tags is displayed.
my code goes like this.
class blog(models.Model):
title = models.CharField(max_length = 200, unique = True)
slug = models.SlugField(max_length = 200, unique = True)
body = RichTextField()
uid = models.AutoField(primary_key = True)
posted_on = models.DateField(auto_now_add= True, db_index = True)
blogger = models.ForeignKey(blogger)
def __str__(self):
return self.title
form.html:- form for entry
<form method = 'POST' action = "{% url 'blog.views.addblog' %}">
{% csrf_token %}
<div class="form-group">
{}
{{form|crispy}}
<center>
<input type="submit" class="btn btn-success" value = "Post"></center>
</form>.
This is how I'm trying to display data on another HTML page. Blog is context passed containing blog details like body and title:
<h1>{{blog.title }}</h1>
<p> {{blog.body|linebreaks}}</p>
how to get data back in rich text format?