diff --git a/templates/deletedTest.html b/templates/deletedTest.html new file mode 100644 index 0000000..baf3f6c --- /dev/null +++ b/templates/deletedTest.html @@ -0,0 +1,4 @@ +Usunąłeś test! + + +Home \ No newline at end of file diff --git a/templates/myTests.html b/templates/myTests.html index b19649e..1162360 100644 --- a/templates/myTests.html +++ b/templates/myTests.html @@ -21,7 +21,7 @@
- +

diff --git a/trials/urls.py b/trials/urls.py index d9c40fc..60d6d00 100644 --- a/trials/urls.py +++ b/trials/urls.py @@ -14,7 +14,8 @@ urlpatterns = [ path('/mark', TestValidateAPIView.as_view()), path('/result', TestResultView.as_view()), path('/edit', EditTestTemplateView.as_view()), - path('delete', deleteTest, name="deleteTest"), + path('/remove', deleteTest, name = "deleteTest"), + # path('delete', deleteTest, name="deleteTest"), path('add/test', addTest, name="newTest"), path('add/questions', addQuestions, name="addQuestions"), path('my', myTests, name="myTests"), diff --git a/trials/views.py b/trials/views.py index 1246dd9..674b718 100644 --- a/trials/views.py +++ b/trials/views.py @@ -161,8 +161,11 @@ class EditTestTemplateView(TemplateView): template = get_template(template_name) return HttpResponse(template.render(context)) -def deleteTest(TemplateView): - pass +def deleteTest(request, test_id): + Test.objects.filter(id=test_id).delete() + return render(request, 'deletedTest.html') + + class TestModelViewSet(viewsets.ModelViewSet):