diff options
author | Dan McGee <dan@archlinux.org> | 2013-11-26 04:10:10 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-11-26 04:10:10 +0100 |
commit | 06317908f73420224fce0c400048c3b7dcfc8abb (patch) | |
tree | 20d47adfbf4a7d211e541f71e58dcc84ccbc882f /devel | |
parent | 5943f92e4c6d52bec6a1e68ad11970da9b8ad643 (diff) | |
parent | c1346ede6401ac19e6f669c81c2411794dcf81f3 (diff) | |
download | archweb-06317908f73420224fce0c400048c3b7dcfc8abb.tar.gz archweb-06317908f73420224fce0c400048c3b7dcfc8abb.tar.xz |
Merge branch 'retro'
Diffstat (limited to 'devel')
-rw-r--r-- | devel/views.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/devel/views.py b/devel/views.py index 378d6d5..b6e8582 100644 --- a/devel/views.py +++ b/devel/views.py @@ -20,7 +20,7 @@ from django.utils.http import http_date from django.utils.timezone import now from .forms import ProfileForm, UserProfileForm, NewUserForm -from .models import DeveloperKey +from .models import DeveloperKey, UserProfile from main.models import Package, PackageFile from main.models import Arch, Repo from news.models import News @@ -158,10 +158,11 @@ def clock(request): @login_required @never_cache def change_profile(request): + profile, _ = UserProfile.objects.get_or_create(user=request.user) if request.POST: form = ProfileForm(request.POST) profile_form = UserProfileForm(request.POST, request.FILES, - instance=request.user.userprofile) + instance=profile) if form.is_valid() and profile_form.is_valid(): request.user.email = form.cleaned_data['email'] if form.cleaned_data['passwd1']: @@ -172,7 +173,7 @@ def change_profile(request): return HttpResponseRedirect('/devel/') else: form = ProfileForm(initial={'email': request.user.email}) - profile_form = UserProfileForm(instance=request.user.userprofile) + profile_form = UserProfileForm(instance=profile) return render(request, 'devel/profile.html', {'form': form, 'profile_form': profile_form}) |