2013-09-28 17:17:15 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2013-12-15 18:27:59 +01:00
|
|
|
|
2013-11-08 06:57:19 +01:00
|
|
|
from django.views.generic import UpdateView
|
2013-11-24 09:37:47 +01:00
|
|
|
from django.contrib.auth import get_user_model
|
2013-09-28 18:33:45 +02:00
|
|
|
from django.core.urlresolvers import reverse
|
2013-09-28 17:17:15 +02:00
|
|
|
|
2013-09-28 18:33:45 +02:00
|
|
|
from .forms import UserProfileForm
|
2013-09-28 17:17:15 +02:00
|
|
|
|
2013-09-28 18:33:45 +02:00
|
|
|
|
|
|
|
class UserProfileView(UpdateView):
|
2013-09-28 17:17:15 +02:00
|
|
|
template_name = "accounts/user_profile.html"
|
2013-11-24 09:37:47 +01:00
|
|
|
model = get_user_model()
|
2013-10-31 23:41:44 +01:00
|
|
|
fields = ['first_name', 'last_name', 'email']
|
2013-09-28 18:33:45 +02:00
|
|
|
form_class = UserProfileForm
|
|
|
|
|
2013-10-03 17:55:48 +02:00
|
|
|
def get_object(self, queryset=None):
|
2013-09-28 18:33:45 +02:00
|
|
|
return self.request.user
|
|
|
|
|
|
|
|
def get_success_url(self):
|
|
|
|
return reverse('account_profile')
|
2013-09-28 17:17:15 +02:00
|
|
|
|
|
|
|
def get_context_data(self, *args, **kwargs):
|
|
|
|
context = super(UserProfileView, self).get_context_data(*args, **kwargs)
|
|
|
|
context['nav_user_profile'] = True
|
|
|
|
return context
|