2b049e4e4496602d4b435f1a34175abea90aa70a
[cas.git] / src / accounts / views.py
1 from django.contrib.auth.mixins import LoginRequiredMixin
2 from django.contrib import messages
3 from django.utils.translation import ugettext as _
4 from django.views.generic.edit import UpdateView
5 from accounts.forms import UserBasicForm
6
7
8 class ProfileView(LoginRequiredMixin, UpdateView):
9     form_class = UserBasicForm
10     template_name = "account/profile.html"
11     success_url = '/accounts/'
12
13     def get_object(self):
14         return self.request.user
15
16     def form_valid(self, form):
17         retval = super().form_valid(form)
18         messages.add_message(self.request, messages.INFO, _("Profile has been changed."))
19         return retval