diff --git a/activitypub/urls.py b/activitypub/urls.py index 9ec2866..be32caa 100644 --- a/activitypub/urls.py +++ b/activitypub/urls.py @@ -1,13 +1,13 @@ from django.conf.urls import url from django.contrib import admin -from activitypub.views import person, note, notes, inbox, outbox, followers -from activitypub.views import noop +from activitypub.views import person, note, notes, inbox, outbox +from activitypub.views import followers, following urlpatterns = [ url(r'^@(\w+)/notes/(\w+)', note, name="note"), url(r'^@(\w+)/notes', notes, name="notes"), - url(r'^@(\w+)/following', noop, name="following"), + url(r'^@(\w+)/following', following, name="following"), url(r'^@(\w+)/followers', followers, name="followers"), url(r'^@(\w+)/inbox', inbox, name="inbox"), url(r'^@(\w+)/outbox', outbox, name="outbox"), diff --git a/activitypub/views.py b/activitypub/views.py index ee4a025..1554a5c 100644 --- a/activitypub/views.py +++ b/activitypub/views.py @@ -187,3 +187,8 @@ def followers(request, username): person = get_object_or_404(Person, username=username) followers = activities.OrderedCollection(person.followers.all()) return JsonResponse(followers.to_json(context=True)) + +def following(request, username): + person = get_object_or_404(Person, username=username) + following = activities.OrderedCollection(person.following.all()) + return JsonResponse(following.to_json(context=True))