.
This commit is contained in:
@@ -13,6 +13,7 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
||||
|
||||
|
||||
class AnatomyUserAnswerTable(tables.Table):
|
||||
select = tables.CheckBoxColumn(accessor=(""))
|
||||
delete = tables.LinkColumn(
|
||||
"anatomy:anatomy_user_answer_delete", text="Delete", args=[A("pk")], orderable=False
|
||||
)
|
||||
|
||||
+3
-1
@@ -62,6 +62,8 @@ from helpers.images import image_as_base64
|
||||
|
||||
from django.template.defaulttags import register
|
||||
|
||||
from generic.mixins import SuperuserRequiredMixin
|
||||
|
||||
|
||||
@register.filter
|
||||
def get_item(dictionary, key):
|
||||
@@ -944,6 +946,6 @@ def question_save_annotation(request, pk):
|
||||
|
||||
AnatomyExamViews = ExamViews(Exam, "anatomy", "anatomy", loadJsonAnswer)
|
||||
|
||||
class UserAnswerDelete(DeleteView):
|
||||
class UserAnswerDelete(SuperuserRequiredMixin, DeleteView):
|
||||
model = CidUserAnswer
|
||||
success_url = reverse_lazy("anatomy:anatomy_user_answer_view")
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
|
||||
|
||||
class SuperuserRequiredMixin(UserPassesTestMixin):
|
||||
def test_func(self):
|
||||
return self.request.user.is_superuser
|
||||
Reference in New Issue
Block a user