API¶
Action Manager¶
- class actstream.managers.ActionManager(*args, **kwargs)[source]¶
Default manager for Actions, accessed through Action.objects
- action_object(obj, **kwargs)[source]¶
Stream of most recent actions where obj is the action_object. Keyword arguments will be passed to Action.objects.filter
- actor(obj, **kwargs)[source]¶
Stream of most recent actions where obj is the actor. Keyword arguments will be passed to Action.objects.filter
- any(obj, **kwargs)[source]¶
Stream of most recent actions where obj is the actor OR target OR action_object.
Follow Manager¶
- class actstream.managers.FollowManager(*args, **kwargs)[source]¶
Manager for Follow model.
- followers(actor, flag='')[source]¶
Returns a list of User objects who are following the given actor (eg my followers).
Views¶
- actstream.views.actor(request, content_type_id, object_id)[source]¶
Actorfocused activity stream for actor defined bycontent_type_id,object_id.
- actstream.views.detail(request, action_id)[source]¶
Actiondetail view (pretty boring, mainly used for get_absolute_url)
- actstream.views.follow_unfollow(request, content_type_id, object_id, flag=None, do_follow=True, actor_only=True)[source]¶
Creates or deletes the follow relationship between
request.userand the actor defined bycontent_type_id,object_id.
- actstream.views.followers(request, content_type_id, object_id, flag=None)[source]¶
Creates a listing of
User``s that follow the actor defined by ``content_type_id,object_id.
- actstream.views.following(request, user_id, flag=None)[source]¶
Returns a list of actors that the user identified by
user_idis following (eg who im following).
- actstream.views.model(request, content_type_id)[source]¶
Actorfocused activity stream for actor defined bycontent_type_id,object_id.
- actstream.views.respond(request, code)[source]¶
Responds to the request with the given response code. If
nextis in the form, it will redirect instead.
Feeds¶
- class actstream.feeds.AbstractActivityStream[source]¶
Abstract base class for all stream rendering. Supports hooks for fetching streams and formatting actions.
- format_action_object(action)[source]¶
Returns a formatted dictionary for the action object of the action.
- format_item(action, item_type='actor')[source]¶
Returns a formatted dictionary for an individual item based on the action and item_type.
- get_uri(action, obj=None, date=None)[source]¶
Returns an RFC3987 IRI ID for the given object, action and date.
Atom¶
Compatible with Atom Activity Streams 1.0 spec
- class actstream.feeds.AtomUserActivityFeed[source]¶
Atom feed of Activity for a given user (where actions are those that the given user follows).
JSON¶
Compatible with JSON Activity Streams 1.0 spec
- class actstream.feeds.AtomUserActivityFeed[source]¶
Atom feed of Activity for a given user (where actions are those that the given user follows).
Actions¶
- actstream.actions.action_handler(verb, **kwargs)[source]¶
Handler function to create Action instance upon action signal call.
- actstream.actions.follow(user, obj, send_action=True, actor_only=True, flag='', **kwargs)[source]¶
Creates a relationship allowing the object’s activities to appear in the user’s stream.
Returns the created
Followinstance.If
send_actionisTrue(the default) then a<user> started following <object>action signal is sent. Extra keyword arguments are passed to the action.send call.If
actor_onlyisTrue(the default) then only actions where the object is the actor will appear in the user’s activity stream. Set toFalseto also include actions where this object is the action_object or the target.If
flagnot an empty string then the relationship would marked by this flag.Example:
follow(request.user, group, actor_only=False) follow(request.user, group, actor_only=False, flag='liking')
- actstream.actions.is_following(user, obj, flag='')[source]¶
Checks if a “follow” relationship exists.
Returns True if exists, False otherwise.
Pass a string value to
flagto determine which type of “follow” relationship you want to check.Example:
is_following(request.user, group) is_following(request.user, group, flag='liking')
- actstream.actions.unfollow(user, obj, send_action=False, flag='')[source]¶
Removes a “follow” relationship.
Set
send_actiontoTrue(False is default) to also send a ``<user> stopped following <object>action signal.Pass a string value to
flagto determine which type of “follow” relationship you want to remove.Example:
unfollow(request.user, other_user) unfollow(request.user, other_user, flag='watching')