some reset ansnwer improvements
This commit is contained in:
@@ -56,6 +56,8 @@
|
||||
|
||||
<button title="This will clear all user answers and attempts"
|
||||
hx-post="{% url 'atlas:collection_reset_answers' collection.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Are you sure you want to reset all answers? This action cannot be undone."
|
||||
>Reset all answers</button>
|
||||
|
||||
</details>
|
||||
|
||||
@@ -49,6 +49,7 @@ Exam mode: {{ exam.exam_mode }}<br />
|
||||
<button title="This will clear all user answers and attempts"
|
||||
hx-post="{% url exam.get_app_name|add:':exam_reset_answers' exam.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Are you sure you want to reset all answers? This action cannot be undone."
|
||||
>Reset all answers</button>
|
||||
|
||||
</details>
|
||||
|
||||
+6
-5
@@ -502,7 +502,10 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
# If a user is an exam author they should have acccess
|
||||
if exam_id is not None:
|
||||
exam = get_object_or_404(self.Exam, pk=exam_id)
|
||||
if exam.open_access or user in exam.get_author_objects():
|
||||
# Remove open_access check for the momement
|
||||
#if exam.open_access or user in exam.get_author_objects():
|
||||
# return True
|
||||
if user in exam.get_author_objects():
|
||||
return True
|
||||
|
||||
if exam.authors_only:
|
||||
@@ -1046,10 +1049,8 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
if request.htmx:
|
||||
exam = get_object_or_404(self.Exam, pk=exam_id)
|
||||
|
||||
if not request.user.groups.filter(name="cid_user_manager").exists():
|
||||
# raise PermissionDenied
|
||||
if request.user not in exam.author.all():
|
||||
raise PermissionDenied
|
||||
if not self.check_user_edit_access(request.user, exam_id):
|
||||
raise PermissionDenied
|
||||
|
||||
## Delete all answers
|
||||
exam.cid_user_answers.all().delete()
|
||||
|
||||
Reference in New Issue
Block a user