Can't access text saved in a Quill form field on Django template

Viewed 1088

In my django template I want to access the bio prop of an instance of my Creator class. This bio is set up as a QuillField in the Creator model class. When I try to access creator.bio, all that renders to the page is the following:

<django_quill.fields.FieldQuill object at 0x1084ce518>

What I want is the actual paragraph of formatted text (ie. the bio) that I typed into the form and saved. As of now, the QuillField is only accessible through the form in the Django admin page. The problem has nothing to do with the Quill UI, but rather being able to access the text I wrote into that form field and render it to the page in a readable format.

From models.py:

from django.db import models
from django_quill.fields import QuillField

class Creator(models.Model):
    name = models.CharField(max_length=100)
    title = models.CharField(max_length=100, default='Creator')
    bio = QuillField()
    photo = models.ImageField(upload_to='images/', default='static/assets/icons/user-solid.svg')
    email = models.EmailField(max_length=100)
    website = models.URLField(max_length=1000, blank=True)
    facebook = models.URLField(max_length=1000, blank=True)
    twitter = models.URLField(max_length=1000, blank=True)
    instagram = models.URLField(max_length=1000, blank=True)

    def __str__(self):
        return self.name

In views.py:

def about(request):
    context = {"creators" : Creator.objects.all()}
    return render(request, 'about.html', context)

And, in the template:

        <section id="creator-container">
            {% for creator in creators %}
                <div class="creator-square">
                    <h4>{{ creator.name }}</h4>
                    <h5>{{ creator.title }}</h5>
                    <img src="../../media/{{ creator.photo }}" alt="{{actor.name}} headshot" id="creator-photo">
                    <p class="creator-bio">{{ creator.bio }}</p>
                </div>
            {% endfor %}
        </section>

If I print the creator.bio object to the console, this is what I get:

{"delta":"{\"ops\":[{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"bold\":true},\"insert\":\"Sharon Yablon\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\" is an award-winning playwright who has been writing and directing her plays in Los Angeles for many years. Her work has appeared in a variety of sites, and on stage with The Echo Theater Company, Padua Playwrights, Zombie Joe's Underground Theater, The Lost Studio, Theater Unleashed, Bootleg, Theater of N.O.T.E., and others. Her short stories, \\\"Perfidia\\\" and \\\"The Caller,\\\" can be found in journals, and her published plays are in \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"Desert Road's One Acts of Note\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\", \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"Fever Dreams\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\", \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"Los Angeles Under the Influence\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\", \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"LA Writers and Their Works\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\", and others. She was co-editor of an anthology of plays from the LA underground scene titled \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"I Might Be The Person You Are Talking To, \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\"and most recently, her play \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"Hello Stranger\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\" (Theater of N.O.T.E., 2017) was published by Original Works. She is a frequent writer and sometime co-curator with Susan Hayden's \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"Library Girl\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\", a \\\"Best of the Westside\\\" monthly literary series centered around a music theme. Her one-acts inspired by crimes in LA history have appeared in \"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\",\"italic\":true},\"insert\":\"LA True Crime’s\"},{\"attributes\":{\"background\":\"transparent\",\"color\":\"#000000\"},\"insert\":\" quarterly evenings since its inception in 2015. \"},{\"insert\":\"\\n\"}]}","html":"<p><strong style=\"background-color: transparent; color: rgb(0, 0, 0);\">Sharon Yablon</strong><span style=\"background-color: transparent; color: rgb(0, 0, 0);\"> is an award-winning playwright who has been writing and directing her plays in Los Angeles for many years. Her work has appeared in a variety of sites, and on stage with The Echo Theater Company, Padua Playwrights, Zombie Joe's Underground Theater, The Lost Studio, Theater Unleashed, Bootleg, Theater of N.O.T.E., and others. Her short stories, \"Perfidia\" and \"The Caller,\" can be found in journals, and her published plays are in </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">Desert Road's One Acts of Note</em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\">, </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">Fever Dreams</em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\">, </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">Los Angeles Under the Influence</em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\">, </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">LA Writers and Their Works</em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\">, and others. She was co-editor of an anthology of plays from the LA underground scene titled </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">I Might Be The Person You Are Talking To, </em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\">and most recently, her play </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">Hello Stranger</em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\"> (Theater of N.O.T.E., 2017) was published by Original Works. She is a frequent writer and sometime co-curator with Susan Hayden's </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">Library Girl</em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\">, a \"Best of the Westside\" monthly literary series centered around a music theme. Her one-acts inspired by crimes in LA history have appeared in </span><em style=\"background-color: transparent; color: rgb(0, 0, 0);\">LA True Crime’s</em><span style=\"background-color: transparent; color: rgb(0, 0, 0);\"> quarterly evenings since its inception in 2015. </span></p>"}

Does anyone know how to access this so that it renders correctly, as HTML text?

1 Answers
Related