From 62a5ed7a9ed0463e13beb67240eb750fd7986e55 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sat, 25 Sep 2021 19:53:06 +1000 Subject: [PATCH] identify group manager --- bookwyrm/templates/groups/members.html | 13 ++++++------- bookwyrm/templatetags/bookwyrm_tags.py | 13 +++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/bookwyrm/templates/groups/members.html b/bookwyrm/templates/groups/members.html index 55d7fd749..7dce08918 100644 --- a/bookwyrm/templates/groups/members.html +++ b/bookwyrm/templates/groups/members.html @@ -1,6 +1,7 @@ {% load i18n %} {% load utilities %} {% load humanize %} +{% load bookwyrm_tags %} {% if request.GET.updated %}
@@ -29,11 +30,9 @@
{% endblock %} - \ No newline at end of file + {% identify_manager %} + + {% endfor %} + \ No newline at end of file diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index e00a8331d..a219beb4f 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -1,6 +1,7 @@ """ template filters """ from django import template from django.db.models import Avg +from django.utils.safestring import mark_safe from bookwyrm import models, views @@ -98,3 +99,15 @@ def mutuals_count(context, user): if not viewer.is_authenticated: return None return user.followers.filter(followers=viewer).count() + +@register.simple_tag(takes_context=True) +def identify_manager(context): + """boolean for whether user is group manager""" + group = context['group'] + member = context['member'] + snippet = mark_safe('') + + if group.manager == member: + snippet = mark_safe('Manager') + + return snippet \ No newline at end of file