diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index c73e203..e79d83e 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -114,7 +114,7 @@
+{% endblock %} diff --git a/evidence/urls.py b/evidence/urls.py index 7a6e992..3a20d41 100644 --- a/evidence/urls.py +++ b/evidence/urls.py @@ -15,4 +15,5 @@ app_name = 'evidence' urlpatterns = [ path("", views.ListEvidencesView.as_view(), name="list"), + path("upload", views.UploadView.as_view(), name="upload"), ] diff --git a/evidence/views.py b/evidence/views.py index 543283b..08cb886 100644 --- a/evidence/views.py +++ b/evidence/views.py @@ -9,7 +9,7 @@ from django.views.generic.edit import ( from dashboard.mixins import DashboardView from evidence.models import Evidence, Annotation -# from snapshot.forms import UploadForm +from evidence.forms import UploadForm # from django.shortcuts import render # from rest_framework import viewsets # from snapshot.serializers import SnapshotSerializer @@ -36,10 +36,19 @@ class ListEvidencesView(DashboardView, TemplateView): return context -# class UploadView(DashboardView, FormView): -# template_name = "upload.html" -# section = "snapshots" -# title = _("Upload Snapshot") -# breadcrumb = "Snapshots / Upload" -# success_url = reverse_lazy('snashot:list') -# form_class = UploadForm +class UploadView(DashboardView, FormView): + template_name = "upload.html" + section = "evidences" + title = _("Upload Evidence") + breadcrumb = "Evidences / Upload" + success_url = reverse_lazy('evidence:list') + form_class = UploadForm + + def form_valid(self, form): + form.save(self.request.user) + response = super().form_valid(form) + return response + + def form_invalid(self, form): + response = super().form_invalid(form) + return response