Add migration actions for Rapid questions to Shorts in admin and templates

This commit is contained in:
Ross
2026-03-25 21:12:30 +00:00
parent ec0bad02c6
commit 06fe73e2a3
6 changed files with 168 additions and 0 deletions
@@ -14,6 +14,11 @@
<a href="{% url 'rapids:mark_review' exam_pk=exam.pk sk=0 %}"><button>Review exam</button></a></p>
{% endif %}
{# Migrate all rapids in this exam to shorts (exam authors + superusers) #}
{% if request.user.is_superuser or request.user in exam.author.all %}
<a href="{% url 'rapids:exam_migrate_rapids_to_shorts' pk=exam.pk %}" onclick="return confirm('Migrate all rapids in this exam to shorts? This will create new short questions.')"><button>Migrate all to Shorts</button></a>
{% endif %}
<ol id="full-question-list" class="sortable">
{% for question in questions.all %}
@@ -10,6 +10,10 @@
<a href="{% url 'admin:rapids_rapid_change' question.id %}" title="Edit the Rapid using the admin interface">Admin Edit</a>
<a href="{% url 'rapids:question_user_answers' question.id %}" title="View user answers associated with this question">User answers</a>
{% 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 %}
<a href="{% url 'rapids:question_migrate_to_shorts' pk=question.pk %}" onclick="return confirm('Migrate this Rapid to a Short question?')">Migrate to Shorts</a>
{% endif %}
{% if exam %}
<div>