Welcome to djust
Real-time, multi-user UI in plain Python.
apps/home/views.pypython
@action
def react(self, emoji="", **kwargs):
if emoji not in EMOJIS:
return
row, _ = ReactionCount.objects.get_or_create(emoji=emoji)
row.count += 1
row.save()
self._rebuild_reactions()
push_to_view(
"apps.home.views.HomeView",
state={"reactions": self.reactions},
)Live — try it
Live poll
Which djust feature next?
Show code
python
@action
def vote(self, option="", **kwargs):
if option not in POLL_OPTIONS:
return
row, _ = PollVote.objects.get_or_create(option=option)
row.count += 1
row.save()
self._rebuild_poll()
push_to_view(
"apps.home.views.HomeView",
state={"poll_data": self.poll_data},
)Live guestbook
Hit Enter to post. Others see it instantly.
- No messages yet — be the first.
Show code
python
@action
def post_message(self, text="", **kwargs):
text = (text or "").strip()[:280]
if not text:
return
GuestbookMessage.objects.create(text=text)
self._rebuild_messages()
push_to_view(
"apps.home.views.HomeView",
state={"messages": self.messages},
)