Activity Feed

Real-time activity feed with streaming support.

python 5 params

Preview

A
Ada commented on PR #4122m ago
G
Grace merged main1h ago
Arguments
activity_feed(events=[{'user': 'Ada', 'action': 'commented on', 'target': 'PR #412', 'time': '2m ago'}, {'user': 'Grace', 'action': 'merged', 'target': 'main', 'time': '1h ago'}])

Usage

views.py
python
from djust import LiveView
from djust.components import ActivityFeed


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = ActivityFeed(events=[{'user': 'Ada', 'action': 'commented on', 'target': 'PR #412', 'time': '2m ago'}, {'user': 'Grace', 'action': 'merged', 'target': 'main', 'time': '1h ago'}])
my_template.html
django
{{ component }}

Needs a client hook djust does not ship: dj-hook="ActivityFeed". The markup renders, but the interaction described above is yours to add — register window.djust.hooks.ActivityFeed = { mounted() { … } } before client.js loads (see the hooks guide).

Parameters

NameTypeDefault
eventsList[dict] | NoneNone
stream_eventstr — the event your server pushes to it''
max_itemsint50
custom_classstr''
**kwargs— passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state
Source & styles
FilePathNotes
moduledjust.components.components.activity_feedSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 9 of this component's classes at line 2254, 2255, 2257, 2259, 2260, 2261, 2262, 2263, 2264. Override those rules, or the custom properties they read, in a stylesheet loaded after it.