Implement (for real this time) the following endpoint

GET /@<username>/following
master
Romain Gauthier 2017-07-29 19:36:21 +02:00
rodzic 0f950fd974
commit 68f49a2b90
2 zmienionych plików z 8 dodań i 3 usunięć

Wyświetl plik

@ -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"),

Wyświetl plik

@ -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))