.
This commit is contained in:
@@ -38,6 +38,10 @@ class RapidTable(tables.Table):
|
||||
text='Clone',
|
||||
args=[A('pk')],
|
||||
orderable=False)
|
||||
delete = tables.LinkColumn('rapids:question_delete',
|
||||
text='Delete',
|
||||
args=[A('pk')],
|
||||
orderable=False)
|
||||
images = ImageColumn("images", orderable=False)
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
<a href="{% url 'rapids:rapid_update' pk=question.pk %}" title="Edit the Rapid">Edit</a>
|
||||
<a href="{% url 'rapids:rapid_clone' pk=question.pk %}" title="Clone the Rapid (duplicate everything but the images)">Clone</a>
|
||||
<a href="{% url 'rapids:question_delete' pk=question.pk %}" title="Delete the Rapid">Delete</a>
|
||||
<a href="{% url 'rapids:rapid_add_note' pk=question.pk %}"> Add Note</a>
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:rapids_rapid_change' question.id %}" title="Edit the Rapid using the admin interface">Admin Edit</a>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{% include 'confirm_delete.html' %}
|
||||
@@ -17,6 +17,7 @@ urlpatterns = [
|
||||
#path("verified/", views.verified, name="verified"),
|
||||
#path("all_questions/", views.all_questions, name="all_questions"),
|
||||
path("question/<int:pk>/scrap", views.rapid_scrap, name="rapid_scrap"),
|
||||
path("question/<int:pk>/delete", views.QuestionDelete.as_view(), name="question_delete"),
|
||||
path("exam/<int:pk>/<int:sk>/mark", views.mark, name="mark"),
|
||||
path("exam/<int:pk>/mark", views.RapidExamViews.mark_overview, name="mark_overview"),
|
||||
# path("exam/<int:pk>/<int:sk>/", views.exam_take, name="exam_take"),
|
||||
|
||||
+4
-1
@@ -70,7 +70,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class AuthorOrCheckerRequiredMixin(object):
|
||||
def get_object(self, *args, **kwargs):
|
||||
obj = super(UpdateView, self).get_object(*args, **kwargs)
|
||||
obj = super().get_object(*args, **kwargs)
|
||||
if self.request.user.groups.filter(name="rapid_checker").exists():
|
||||
return obj
|
||||
if self.request.user not in obj.author.all():
|
||||
@@ -871,5 +871,8 @@ def exam_scores_cid_user(request, pk, sk):
|
||||
)
|
||||
|
||||
|
||||
class QuestionDelete(AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
model = Rapid
|
||||
success_url = reverse_lazy("rapids:rapid_view")
|
||||
|
||||
RapidExamViews = ExamViews(Exam, "rapids", "rapid", loadJsonAnswer)
|
||||
Reference in New Issue
Block a user