django-activity-streamGenerate generic activity streams from the actions on your site. Users can follow any actor's activities for personalized streams | |
Download |
django-activity-stream Ranking & Summary
Advertisement
- License:
- BSD License
- Price:
- FREE
- Publisher Name:
- Justin Quick
- Publisher web site:
- http://code.google.com/u/justquick/
django-activity-stream Tags
django-activity-stream Description
Generate generic activity streams from the actions on your site. Users can follow any actor's activities for personalized streams django-activity-stream is a way of creating activities generated by the actions on your site. Activity events are categorized by three main components. * Actor. The object that performed the action. * Verb. The verb phrase of the action performed. * Target. (Optional) The object that the verb is enacted on.Actor and Target are GenericForeignKeys to any arbitrary Django object. An activity is a description of an action that was performed (Verb) at some instant in time by some Acor, with some optional Target.Nomenclature of this specification is based on the Atom Activity Extension.Installation:Add actstream to your INSTALLED_APPS:INSTALLED_APPS = ( ... 'actstream', ...)Add the activity urls:urlpatterns = patterns('', ... ('^activity/', include('actstream.urls')), ...)Generating ActionsGenerating actions is probably best done in a separate signal:from django.db.models.signals import pre_savefrom actstream import actionfrom myapp.models import MyModeldef my_handler(sender, **kwargs): action.save(sender, verb='was saved')pre_save.connect(my_handler, sender=MyModel)To generate an action anywhere in your code, simply import the action signal and send it with your actor, verb, and target:from actstream import actionaction.send(request.user, verb='reached level 10')action.send(request.user, verb='joined', target=group)Following ActorsGenerating the link between a User and any particular Actor is as easy as calling a function:from actstream import followfollow(request.user, group)You can also just make a GET request to the actstream_follow view:GET /activity/follow/< content_type_id >/< object_id >/?next=/blog/Then the current logged in user will follow the actor defined by content_type_id & object_id. Optional next parameter is URL to redirect to.Activity FeedsListings of activities are available for several points of view. All are sorted by -timestamp:from actstream import actor_stream, user_stream, model_streamActivities by actor:actor_stream(actor)Activities by Django Model:model_stream(model)Activities from actors that a particular user is folowing:user_stream(user) Requirements: · Python · Django
django-activity-stream Related Software