Thomas Waldmann b5d036eb72 add email to user profile form, so it can be updated by the user
cosmetic change to the profile view headings
2013-10-31 23:41:44 +01:00

34 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
from django.views.generic import TemplateView, UpdateView
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from .forms import UserProfileForm
class UserProfileView(UpdateView):
template_name = "accounts/user_profile.html"
model = User
fields = ['first_name', 'last_name', 'email']
form_class = UserProfileForm
def get_object(self, queryset=None):
return self.request.user
def get_success_url(self):
return reverse('account_profile')
def get_context_data(self, *args, **kwargs):
context = super(UserProfileView, self).get_context_data(*args, **kwargs)
context['nav_user_profile'] = True
return context
class PasswordChangeView(TemplateView):
template_name = "registration/password_change.html"
def get_context_data(self, *args, **kwargs):
context = super(PasswordChangeView, self).get_context_data(*args, **kwargs)
context['nav_change_password'] = True
return context