Как я могу использовать UpdateView?

У меня есть две, предположительно связанные, проблемы с UpdateView. Во-первых, это не обновление пользователя, а создание нового объекта пользователя. Во-вторых, я не могу ограничить поля, отображаемые в форме.

Вот мой views.py:

class RegistrationView(FormView):
    form_class = RegistrationForm 
    template_name = "register.html"
    success_url = "/accounts/profile/" 

    def form_valid(self, form):
        if form.is_valid:
            user = form.save() 
            user = authenticate(username=user.username, password=form.cleaned_data['password1'])
            login(self.request, user)
            return super(RegistrationView, self).form_valid(form) #I still have no idea what this is

class UserUpdate(UpdateView):
    model = User
    form_class = RegistrationForm
    fields = ['username', 'first_name']
    template_name = "update.html"
    success_url = "/accounts/profile/" 

и urls.py

url(r'^create/

Как правильно использовать UpdateView? Заранее спасибо.

, RegistrationView.as_view(), name="create-user"), url(r'^profile/(?P\d+)/edit/

Как правильно использовать UpdateView? Заранее спасибо.

, UserUpdate.as_view(), name="user-update"),

Как правильно использовать UpdateView? Заранее спасибо.

Ответы на вопрос(3)

Ваш ответ на вопрос