forked from gergely/calendar-social
Compare commits
1 Commits
master
...
friend-lis
Author | SHA1 | Date | |
---|---|---|---|
2738c5d84c |
@ -310,6 +310,21 @@ class Profile(db.Model): # pylint: disable=too-few-public-methods
|
|||||||
.filter(UserFollow.followed == self) \
|
.filter(UserFollow.followed == self) \
|
||||||
.filter(UserFollow.accepted_at.isnot(None))
|
.filter(UserFollow.accepted_at.isnot(None))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def friend_list(self):
|
||||||
|
"""List of friends (ie. where both profiles follow each other)
|
||||||
|
"""
|
||||||
|
|
||||||
|
# This will always be empty for remote profiles
|
||||||
|
if not self.user:
|
||||||
|
return []
|
||||||
|
|
||||||
|
reverse = db.aliased(UserFollow)
|
||||||
|
return UserFollow.query \
|
||||||
|
.filter(UserFollow.follower == self) \
|
||||||
|
.join(reverse, UserFollow.followed == reverse.follower) \
|
||||||
|
.filter(UserFollow.follower == reverse.followed)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def url(self):
|
def url(self):
|
||||||
"""Get the URL for this profile
|
"""Get the URL for this profile
|
||||||
|
Loading…
Reference in New Issue
Block a user