diff options
author | Leif Johansson <leifj@sunet.se> | 2011-11-08 14:10:17 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-11-08 14:10:42 +0100 |
commit | baf5f96d25c5f378169ac910f9535d29a9546e3e (patch) | |
tree | 7c16bc8a98d8a244a78577be8a625001757af89b /coip/apps/opensocial/activitystreams | |
parent | 9ba73ae91642d07aa78789e6e0cedf6ed6250300 (diff) |
produce a basic group-oriented activity stream
Diffstat (limited to 'coip/apps/opensocial/activitystreams')
-rw-r--r-- | coip/apps/opensocial/activitystreams/__init__.py | 0 | ||||
-rw-r--r-- | coip/apps/opensocial/activitystreams/managers.py | 17 | ||||
-rw-r--r-- | coip/apps/opensocial/activitystreams/urls.py | 10 | ||||
-rw-r--r-- | coip/apps/opensocial/activitystreams/views.py | 14 |
4 files changed, 41 insertions, 0 deletions
diff --git a/coip/apps/opensocial/activitystreams/__init__.py b/coip/apps/opensocial/activitystreams/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/coip/apps/opensocial/activitystreams/__init__.py diff --git a/coip/apps/opensocial/activitystreams/managers.py b/coip/apps/opensocial/activitystreams/managers.py new file mode 100644 index 0000000..aaa73f9 --- /dev/null +++ b/coip/apps/opensocial/activitystreams/managers.py @@ -0,0 +1,17 @@ +''' +Created on Nov 8, 2011 + +@author: leifj +''' +from actstream.models import ActionManager +from actstream.views import stream +from datetime import datetime + + +class NameActionManager(ActionManager): + + @stream + def name_activities(self, name, time=None): + if time is None: + time = datetime.now() + return name.actor_actions.filter(timestamp__lte = time)
\ No newline at end of file diff --git a/coip/apps/opensocial/activitystreams/urls.py b/coip/apps/opensocial/activitystreams/urls.py new file mode 100644 index 0000000..e5d0d94 --- /dev/null +++ b/coip/apps/opensocial/activitystreams/urls.py @@ -0,0 +1,10 @@ +''' +Created on Nov 7, 2011 + +@author: leifj +''' +from django.conf.urls.defaults import patterns, url + +urlpatterns = patterns('', + url(r'^@any/(?P<id>[0-9]+)', view='coip.apps.activitystreams.urls') +)
\ No newline at end of file diff --git a/coip/apps/opensocial/activitystreams/views.py b/coip/apps/opensocial/activitystreams/views.py new file mode 100644 index 0000000..a99bec3 --- /dev/null +++ b/coip/apps/opensocial/activitystreams/views.py @@ -0,0 +1,14 @@ +''' +Created on Nov 8, 2011 + +@author: leifj +''' +from django.shortcuts import get_object_or_404 +from coip.apps.name.models import Name +from coip.multiresponse import json_response + +@oauth2_required(scope='memberships') +def name(request,id): + name = get_object_or_404(Name,pk=id) + # check ownership + return json_response(name.actor_actions.name_activities())
\ No newline at end of file |