Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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.

Release History

Release History

This version
History Node

0.5

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-timeline-0.5.tar.gz (7.2 kB) Copy SHA256 Checksum SHA256 Source Jul 28, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting