turbo.mixins

Module Contents

Classes

TurboMixin

Mixin that attaches a .turbo attribute to a django model.

class turbo.mixins.TurboMixin(*args, **kwargs)

Mixin that attaches a .turbo attribute to a django model. This allows for any instance to broadcast to pages listening to the object channel.

Instances must have a primary key assigned to be broadcast, or else a ValueError will be thown.

Ex:

room = Room.objects.first() room.turbo.render(“chat/room_name.html”, {“room”: room}).replace(id=”update-room”)