smoke test the rest of the apps
This commit is contained in:
+9
-41
@@ -99,7 +99,7 @@ from zipview.views import BaseZipView
|
||||
|
||||
import os
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
def normaliseScore(score):
|
||||
@@ -176,46 +176,14 @@ def series_detail(request, pk):
|
||||
@login_required
|
||||
@user_is_author_or_long_checker
|
||||
def long_split(request, pk):
|
||||
long = get_object_or_404(Long, pk=pk)
|
||||
|
||||
images = long.images.all()
|
||||
|
||||
old_abnormality = long.abnormality.all()
|
||||
old_region = long.region.all()
|
||||
old_examination = long.examination.all()
|
||||
old_site = long.site.all()
|
||||
old_author = long.author.all()
|
||||
|
||||
if not images:
|
||||
raise Http404
|
||||
|
||||
for n in range(len(images) - 1):
|
||||
long.pk = None
|
||||
|
||||
long.save()
|
||||
|
||||
long.abnormality.set(old_abnormality)
|
||||
long.region.set(old_region)
|
||||
long.examination.set(old_examination)
|
||||
long.site.set(old_site)
|
||||
long.author.set(old_author)
|
||||
images[n].long = long
|
||||
images[n].save()
|
||||
|
||||
# images[-1].long
|
||||
|
||||
# if request.user not in long.author.all():
|
||||
# raise PermissionDenied
|
||||
|
||||
# logging.debug(long.subspecialty.first().name.all())
|
||||
return render(request, "longs/question_detail.html", {"question": long})
|
||||
raise Http404("Long cases do not support direct image splitting.")
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_author_or_long_checker
|
||||
def author_detail(request, pk):
|
||||
# logging.debug(Author.objects.all())
|
||||
# author = get_object_or_404(Author, pk=pk)
|
||||
if not (request.user.pk == pk or request.user.groups.filter(name='long_checker').exists() or request.user.is_superuser):
|
||||
raise PermissionDenied
|
||||
author = User.objects.get(pk=pk)
|
||||
|
||||
longs = Long.objects.filter(author=pk)
|
||||
@@ -225,7 +193,7 @@ def author_detail(request, pk):
|
||||
)
|
||||
|
||||
|
||||
@user_is_author_or_long_checker
|
||||
@user_is_long_checker
|
||||
def author_list(request):
|
||||
authors = User.objects.all()
|
||||
|
||||
@@ -649,8 +617,8 @@ class LongSeriesView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
|
||||
|
||||
# @user_is_long_marker
|
||||
def mark_answer_override(request, exam_id, question_number, cid):
|
||||
return mark_answer(request, exam_id, question_number, cid, override=True)
|
||||
def mark_answer_override(request, exam_id, question_number, answer_id):
|
||||
return mark_answer(request, exam_id, question_number, answer_id, override=True)
|
||||
|
||||
|
||||
# @user_is_long_marker
|
||||
@@ -1075,14 +1043,14 @@ class UserAnswerDelete(SuperuserRequiredMixin, DeleteView):
|
||||
|
||||
@user_passes_test(lambda u: u.is_superuser)
|
||||
def user_answer_delete_multiple(request):
|
||||
if request.accepts("application/json")():
|
||||
if request.accepts("application/json") and request.method == "POST" and "answer_ids" in request.POST:
|
||||
answer_ids = json.loads(request.POST["answer_ids"])
|
||||
|
||||
# We could probably delete them all at once....
|
||||
for id in answer_ids:
|
||||
UserAnswer.objects.get(pk=id).delete()
|
||||
return JsonResponse({"status": "success"})
|
||||
return JsonResponse({"status": "error"})
|
||||
return JsonResponse({"status": "error"}, status=400)
|
||||
|
||||
|
||||
@user_passes_test(lambda u: u.is_superuser)
|
||||
|
||||
Reference in New Issue
Block a user