Update views.py
added message wich will be shown when a user update his infos
@@ -2,6 +2,8 @@ from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.views.generic import DetailView, RedirectView, UpdateView
+from django.contrib import messages
+from django.utils.translation import ugettext_lazy as _
User = get_user_model()
@@ -27,6 +29,11 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
def get_object(self):
return User.objects.get(username=self.request.user.username)
+ def form_valid(self, form):
+ form.save()
+ messages.add_message(self.request, messages.INFO, _("Infos succefully updated"))
+ return super(UserUpdateView, self).form_valid(form)
+
user_update_view = UserUpdateView.as_view()
