Merge
This commit is contained in:
commit
0c950624bf
4
templates/deletedTest.html
Normal file
4
templates/deletedTest.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Usunąłeś test!
|
||||||
|
|
||||||
|
|
||||||
|
<a href="/home">Home</a>
|
@ -21,7 +21,7 @@
|
|||||||
<div class="tripleButton">
|
<div class="tripleButton">
|
||||||
<button><a href="/tests/{{test.id}}/show">Rozwiąż</a></button>
|
<button><a href="/tests/{{test.id}}/show">Rozwiąż</a></button>
|
||||||
<button><a href="/tests/{{test.id}}/edit">Edytuj</a></button>
|
<button><a href="/tests/{{test.id}}/edit">Edytuj</a></button>
|
||||||
<button style="background:#FF0000;"><a href="/tests/{{test.id}}/edit">Usuń</a></button>
|
<button style="background:#FF0000;"><a href="/tests/{{test.id}}/remove">Usuń</a></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
@ -14,7 +14,8 @@ urlpatterns = [
|
|||||||
path('<int:test_id>/mark', TestValidateAPIView.as_view()),
|
path('<int:test_id>/mark', TestValidateAPIView.as_view()),
|
||||||
path('<int:test_id>/result', TestResultView.as_view()),
|
path('<int:test_id>/result', TestResultView.as_view()),
|
||||||
path('<int:test_id>/edit', EditTestTemplateView.as_view()),
|
path('<int:test_id>/edit', EditTestTemplateView.as_view()),
|
||||||
path('delete', deleteTest, name="deleteTest"),
|
path('<int:test_id>/remove', deleteTest, name = "deleteTest"),
|
||||||
|
# path('delete', deleteTest, name="deleteTest"),
|
||||||
path('add/test', addTest, name="newTest"),
|
path('add/test', addTest, name="newTest"),
|
||||||
path('add/questions', addQuestions, name="addQuestions"),
|
path('add/questions', addQuestions, name="addQuestions"),
|
||||||
path('my', myTests, name="myTests"),
|
path('my', myTests, name="myTests"),
|
||||||
|
@ -161,8 +161,11 @@ class EditTestTemplateView(TemplateView):
|
|||||||
template = get_template(template_name)
|
template = get_template(template_name)
|
||||||
return HttpResponse(template.render(context))
|
return HttpResponse(template.render(context))
|
||||||
|
|
||||||
def deleteTest(TemplateView):
|
def deleteTest(request, test_id):
|
||||||
pass
|
Test.objects.filter(id=test_id).delete()
|
||||||
|
return render(request, 'deletedTest.html')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestModelViewSet(viewsets.ModelViewSet):
|
class TestModelViewSet(viewsets.ModelViewSet):
|
||||||
|
Loading…
Reference in New Issue
Block a user