.
This commit is contained in:
@@ -64,6 +64,7 @@ urlpatterns = [
|
||||
#path('', include('generic.urls')),
|
||||
path("feedback/<str:question_type>/<int:pk>", views.AddQuestionNote.as_view(), name="feedback_create"),
|
||||
path("feedback/note/<int:pk>/complete", views.feedback_mark_complete, name="feedback_mark_complete"),
|
||||
path("feedback/note/<int:pk>/delete", views.feedback_note_delete, name="feedback_note_delete"),
|
||||
#path("feedback/", views.AddQuestionNote.as_view(), name="feedback"),
|
||||
path("feedback/answer", views.answer_suggestion_submit, name="answer_suggestion_submit"),
|
||||
path("feedback/answer_submit", views.answer_submit, name="answer_submit"),
|
||||
|
||||
@@ -225,6 +225,13 @@ class AddQuestionNote(CreateView):
|
||||
|
||||
return response
|
||||
|
||||
@user_passes_test(lambda u: u.is_superuser)
|
||||
def feedback_note_delete(request, pk):
|
||||
q = get_object_or_404(QuestionNote, pk=pk)
|
||||
q.delete()
|
||||
|
||||
return redirect(q.get_object_url())
|
||||
|
||||
@login_required
|
||||
def feedback_mark_complete(request, pk):
|
||||
q = get_object_or_404(QuestionNote, pk=pk)
|
||||
|
||||
@@ -12,6 +12,9 @@ Notes:
|
||||
{% if not note.complete %}
|
||||
(<a href="{% url 'feedback_mark_complete' pk=note.pk %}">Mark complete</a>)
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
(<a href="{% url 'feedback_note_delete' pk=note.pk %}">Delete</a>)
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
Reference in New Issue
Block a user