An application that converts text into uppercase letters
We have already simplified the frontend with Stimulus, installing, configuring, and implementing the tools provided by this fantastic framework. However, we still have one last step left in the application that converts the text from lowercase to uppercase: implementing the backend in the consumer.
Edit app/app_template/consumers.py
with the following code:
from channels.generic.websocket import JsonWebsocketConsumer from django.template.loader import render_to_string class ExampleConsumer(JsonWebsocketConsumer): def connect(self): """Event when client connects""" # Accept the connection self.accept() def receive_json(self, data_received): ...