Created
February 2, 2014 19:47
-
-
Save jcockhren/8773742 to your computer and use it in GitHub Desktop.
Shouldn't this pull the most recent version of the user data on get? see https://gist.github.com/jcockhren/8762001 for supporting code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SettingsView(UpdateView): | |
model = CustomUser | |
form_class = UserForm | |
#form = UserForm(self.instance) | |
template_name = 'account/settings.html' | |
success_url = '/account/settings' | |
fields = ['first_name', | |
'last_name', | |
'email', | |
'company'] | |
def get(self, request, *args, **kwargs): | |
form = UserForm(initial=model_to_dict(CustomUser.objects.get(id=request.user.id))) | |
return render(request, self.template_name, {'form': form}) | |
def get_object(self, queryset=None): | |
return CustomUser.objects.get(id=self.request.user.id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment