add has_groups tag for use on user page

This commit is contained in:
Hugh Rundle 2021-10-02 12:12:59 +10:00
parent 0f3be40957
commit 80fb37b55c

View file

@ -6,6 +6,12 @@ from bookwyrm import models
register = template.Library()
@register.filter(name="has_groups")
def has_groups(user):
"""whether or not the user has a pending invitation to join this group"""
return models.BookwyrmGroupMember.objects.filter(user=user).exists()
@register.filter(name="is_member")
def is_member(group, user):
"""whether or not the user is a member of this group"""