diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-11-28 19:57:27 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-11-28 19:57:27 -0500 |
commit | dbb508b7222081b523ce3e0bd2b69f5fea6c7050 (patch) | |
tree | f5f3a97b9465504ed9e7633a0c385669b7463d3c /devel/views.py | |
parent | fd788c5fcf9009540ad14a869dcebdfd30fb9d6f (diff) | |
parent | b2b6c78e3179cef66cd4e9dcea7f9003f409ce8b (diff) |
Merge tag 'release_2013-11-25' into archweb-generic
Django 1.6 upgrade and other changes
Conflicts:
templates/news/list.html
templates/public/index.html
Diffstat (limited to 'devel/views.py')
-rw-r--r-- | devel/views.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/devel/views.py b/devel/views.py index 378d6d57..29954b51 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,21 +158,22 @@ 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']: request.user.set_password(form.cleaned_data['passwd1']) - with transaction.commit_on_success(): + with transaction.atomic(): request.user.save() profile_form.save() 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}) @@ -274,7 +275,7 @@ def report(request, report_name, username=None): cutoff = timedelta(hours=24) filtered = [] packages = packages.select_related( - 'arch', 'repo', 'packager').filter(pgp_signature__isnull=False) + 'arch', 'repo', 'packager').filter(signature_bytes__isnull=False) known_keys = DeveloperKey.objects.select_related( 'owner').filter(owner__isnull=False) known_keys = {dk.key: dk for dk in known_keys} @@ -334,7 +335,7 @@ def new_user_form(request): if request.POST: form = NewUserForm(request.POST) if form.is_valid(): - with transaction.commit_on_success(): + with transaction.atomic(): form.save() log_addition(request, form.instance.user) return HttpResponseRedirect('/admin/auth/user/%d/' % \ |