bookwyrm/bookwyrm/templatetags/notification_page_tags.py
2022-07-12 10:32:56 -07:00

21 lines
586 B
Python

""" tags used on the feed pages """
from django import template
from bookwyrm.templatetags.feed_page_tags import load_subclass
register = template.Library()
@register.simple_tag(takes_context=False)
def related_status(notification):
"""for notifications"""
if not notification.related_status:
return None
return load_subclass(notification.related_status)
@register.simple_tag(takes_context=False)
def get_related_users(notification):
"""Who actually was it who liked your post"""
return list(reversed(list(notification.related_users.distinct())))[:10]