This commit is contained in:
Ross
2021-08-16 16:02:35 +00:00
parent cf6d3e1ac8
commit e2ad16370b
10 changed files with 137 additions and 42 deletions
+12 -1
View File
@@ -1009,7 +1009,7 @@ class UserAnswerView(LoginRequiredMixin, DetailView):
class UserAnswerTableView(LoginRequiredMixin, SingleTableMixin, FilterView):
model = CidUserAnswer
table_class = RapidUserAnswerTable
template_name = "rapids/rapid_question_view.html"
template_name = "rapids/user_answer_question_view.html"
filterset_class = RapidUserAnswerFilter
@@ -1118,3 +1118,14 @@ class RapidLateralityViewSet(
# get_object_or_404(question, pk=pk)
# return { "content_type" : content_type,
# "object_id" : pk }
@user_passes_test(lambda u: u.is_superuser)
def user_answer_delete_multiple(request):
if request.is_ajax():
answer_ids = json.loads(request.POST["answer_ids"])
# We could probably delete them all at once....
for id in answer_ids:
CidUserAnswer.objects.get(pk=id).delete()
return HttpResponseRedirect(request.path_info)
return HttpResponse("/")