Reader small image

You're reading from  Building SPAs with Django and HTML Over the Wire

Product typeBook
Published inAug 2022
PublisherPackt
ISBN-139781803240190
Edition1st Edition
Tools
Right arrow
Author (1)
Andros Fenollosa
Andros Fenollosa
author image
Andros Fenollosa

Andros Fenollosa is a custom programming expert that works as a teacher, full stack developer, and mobile developer. He's a Web Designer, Web Programmer, and Apps Programmer, among other things ( PWA, Android and iOS ). He has a plethora of commercial expertise, having worked on projects in a variety of locales throughout the world.
Read more about Andros Fenollosa

Right arrow

Rendering database information

We have already built a form that sends a new message to the backend via a WebSockets connection, which we capture in the consumer and then store in the database.

Now we’re going to get all the messages from the database, render them with Django’s template engine, send the HTML to the client over the connection we kept, and inject the content into the appropriate frontend element.

Create the HTML template that will generate all the message blocks in the path /app/website/templates/components/_list-messages.html with the content:

{% for message in messages %}
    <article class="message" id="message--{{ message.id
        }}">
        <h2 class="message__author">{{ message.author }}
        </h2>
        ...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Building SPAs with Django and HTML Over the Wire
Published in: Aug 2022Publisher: PacktISBN-13: 9781803240190

Author (1)

author image
Andros Fenollosa

Andros Fenollosa is a custom programming expert that works as a teacher, full stack developer, and mobile developer. He's a Web Designer, Web Programmer, and Apps Programmer, among other things ( PWA, Android and iOS ). He has a plethora of commercial expertise, having worked on projects in a variety of locales throughout the world.
Read more about Andros Fenollosa