Skip to main content

a Django timeline (activity stream) using redis

Project description

There are two parts to using event streams. The first is to declare an Event, it looks like this:

from django.contrib.auth.models import User

from timeline.base import EventType
from yourapp.library.models import Item


class AddedToLibrary(EventType):
    slug = "added-to-library"
    context_shape = {
        "user": User,
        "item": Item,
    }
    queryable_by = ["user", "item"]

And then there is querying, all querying is encapsulated in the timeline.base.Stream class. It is used like so:

Stream(request.user)

will return a Stream for all of the events for the request.user.pk User. It can take any number of positional arguments and it will combine their streams.

It also takes a number of keyword arguments. event_type which will return only Events for a given slug. limit a number saying how many Events should be included, defaults to 20. cluster a boolean saying whether the data returned should be clustered, if it is than it yields a list of Events, rather than discrete Events.

Project details


Release history Release notifications | RSS feed

This version

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-timeline-0.5.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file django-timeline-0.5.tar.gz.

File metadata

File hashes

Hashes for django-timeline-0.5.tar.gz
Algorithm Hash digest
SHA256 0f06dd38ddba4c18f6a0a6494cf50c438552888c3a44ae3e445a56999ba939e0
MD5 ed1f767ef2a7ccb97bfab95aef4fd667
BLAKE2b-256 4d9d45c078a6956f8907b1f76264bc1cb8221d46a5a2e779b30fd998b5f0cba9

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page