forked from mirrors/bookwyrm
Add following as a related_name for followers.
This commit is contained in:
parent
fc1ed99efa
commit
8cbca4229f
3 changed files with 22 additions and 2 deletions
|
@ -187,7 +187,7 @@ def get_following(request, username):
|
||||||
return HttpResponseBadRequest()
|
return HttpResponseBadRequest()
|
||||||
|
|
||||||
user = models.User.objects.get(localname=username)
|
user = models.User.objects.get(localname=username)
|
||||||
following = models.User.objects.filter(followers=user)
|
following = user.following
|
||||||
page = request.GET.get('page')
|
page = request.GET.get('page')
|
||||||
return JsonResponse(activitypub.get_following(user, page, following))
|
return JsonResponse(activitypub.get_following(user, page, following))
|
||||||
|
|
||||||
|
|
19
fedireads/migrations/0008_auto_20200224_1504.py
Normal file
19
fedireads/migrations/0008_auto_20200224_1504.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.0.3 on 2020-02-24 15:04
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('fedireads', '0007_auto_20200223_0902'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='user',
|
||||||
|
name='followers',
|
||||||
|
field=models.ManyToManyField(related_name='following', through='fedireads.UserRelationship', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
]
|
|
@ -38,7 +38,8 @@ class User(AbstractUser):
|
||||||
'self',
|
'self',
|
||||||
symmetrical=False,
|
symmetrical=False,
|
||||||
through='UserRelationship',
|
through='UserRelationship',
|
||||||
through_fields=('user_subject', 'user_object')
|
through_fields=('user_subject', 'user_object'),
|
||||||
|
related_name='following'
|
||||||
)
|
)
|
||||||
favorites = models.ManyToManyField(
|
favorites = models.ManyToManyField(
|
||||||
'Status',
|
'Status',
|
||||||
|
|
Loading…
Reference in a new issue