added success messages

This commit is contained in:
Thomas Nahuel Rusiecki 2024-11-11 14:57:20 -03:00 committed by pedro
parent ac70a4ae25
commit ac48a77a2f
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import json import json
from django.contrib import messages
from urllib.parse import urlparse from urllib.parse import urlparse
from django.http import HttpResponse from django.http import HttpResponse
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@ -47,11 +48,11 @@ class UploadView(DashboardView, FormView):
def form_valid(self, form): def form_valid(self, form):
form.save(self.request.user) form.save(self.request.user)
messages.success(self.request, _("Evidence uploaded successfully."))
response = super().form_valid(form) response = super().form_valid(form)
return response return response
def form_invalid(self, form): def form_invalid(self, form):
#TODO: change file_input field class to "is-invalid" if any errors occur
response = super().form_invalid(form) response = super().form_invalid(form)
return response return response
@ -71,6 +72,7 @@ class ImportView(DashboardView, FormView):
def form_valid(self, form): def form_valid(self, form):
form.save() form.save()
messages.success(self.request, _("Evidence imported successfully."))
response = super().form_valid(form) response = super().form_valid(form)
return response return response