Skip to content

Commit

Permalink
Add invitation template filter (#11368)
Browse files Browse the repository at this point in the history
Because Django. This is just a wrapper for working around Django templates and calling ``Invitation.can_revoke_invitation`` with arguments.
  • Loading branch information
agjohnson authored May 29, 2024
1 parent 5c0e627 commit 7caede6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Empty file.
14 changes: 14 additions & 0 deletions readthedocs/invitations/templatetags/invitations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Invitation template filters."""

from django import template

from readthedocs.invitations.models import Invitation

register = template.Library()


@register.filter
def can_revoke_invitation(user, object):
if isinstance(object, Invitation):
return object.can_revoke_invitation(user)
return False

0 comments on commit 7caede6

Please sign in to comment.