diff --git a/rapids/templates/rapids/question_link_header.html b/rapids/templates/rapids/question_link_header.html
index b3d6c8f8..980a2cf1 100644
--- a/rapids/templates/rapids/question_link_header.html
+++ b/rapids/templates/rapids/question_link_header.html
@@ -6,12 +6,13 @@
Delete
Edit Answers
Add Note
+ {% load rapids_extras %}
{% if request.user.is_superuser %}
Admin Edit
User answers
{% endif %}
{% comment %} Migrate to shorts (authors / rapid_checkers / superusers) {% endcomment %}
- {% if request.user.is_superuser or request.user in question.author.all or request.user.groups.filter(name='rapid_checker').exists %}
+ {% if request.user.is_superuser or request.user in question.author.all or request.user|has_group:"rapid_checker" %}
Migrate to Shorts
{% endif %}
{% if exam %}
diff --git a/rapids/templatetags/__init__.py b/rapids/templatetags/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/rapids/templatetags/rapids_extras.py b/rapids/templatetags/rapids_extras.py
new file mode 100644
index 00000000..f980512c
--- /dev/null
+++ b/rapids/templatetags/rapids_extras.py
@@ -0,0 +1,12 @@
+from django import template
+
+register = template.Library()
+
+@register.filter(name='has_group')
+def has_group(user, group_name):
+ if user is None:
+ return False
+ try:
+ return user.groups.filter(name=group_name).exists()
+ except Exception:
+ return False