diff --git a/notes/templates/notes/home.html b/notes/templates/notes/home.html
index 235b1dd..f25c20a 100644
--- a/notes/templates/notes/home.html
+++ b/notes/templates/notes/home.html
@@ -4,6 +4,7 @@
{% block body %}
+ {% for message in messages %}
+
{{ message }}
+ {% endfor %}
+
+{% endif %}
diff --git a/notes/templates/notes/note_form.html b/notes/templates/notes/note_form.html
index 086c54e..88c9a35 100644
--- a/notes/templates/notes/note_form.html
+++ b/notes/templates/notes/note_form.html
@@ -4,6 +4,7 @@
{% block body %}
Post a Note
+ {% include "notes/messages.html" %}
{% endblock %}
diff --git a/notes/templates/registration/login.html b/notes/templates/registration/login.html
index 27c5cc2..ade7428 100644
--- a/notes/templates/registration/login.html
+++ b/notes/templates/registration/login.html
@@ -6,14 +6,13 @@
-
+ {% include "notes/messages.html" %}
+
{% endblock %}
diff --git a/notes/views.py b/notes/views.py
index 3603c55..51983f6 100644
--- a/notes/views.py
+++ b/notes/views.py
@@ -1,5 +1,6 @@
from datetime import timedelta
from typing import Any
+from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.utils import timezone
@@ -33,6 +34,7 @@ class PostNoteView(LoginRequiredMixin, CreateView):
note.expiry = timezone.now() + timedelta(seconds=note.to_user.expiry_seconds)
note.from_user = self.request.user
note.save()
+ messages.success(self.request, "Note has been posted!")
return FormMixin.form_valid(self, form)
@@ -43,3 +45,8 @@ class ProfileView(LoginRequiredMixin, UpdateView):
def get_object(self):
return self.request.user
+
+ def form_valid(self, form):
+ ret = super().form_valid(form)
+ messages.success(self.request, "Profile has been updated!")
+ return ret