From a68a3e7ab7d18a45bee07428bfbc4870ced6eee6 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Fri, 21 Sep 2012 14:01:43 -0400 Subject: [PATCH] Get the just-created user from create_user (imported from commit d709c99cc670aa1b0864c40b8c0d5e52b6c90340) --- zephyr/models.py | 1 + zephyr/views.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zephyr/models.py b/zephyr/models.py index 37a2d1a13e..e881bf5c1c 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -98,6 +98,7 @@ def create_user(email, password, realm, full_name, short_name): email=email) user.save() UserProfile.create(user, realm, full_name, short_name) + return user class ZephyrClass(models.Model): name = models.CharField(max_length=30, db_index=True) diff --git a/zephyr/views.py b/zephyr/views.py index ebf76a6cb3..84039b8797 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -173,10 +173,9 @@ def forge_zephyr(request): user = User.objects.get(email=email) except User.DoesNotExist: # forge a user for this person - create_user(email, "test", user_profile.realm, - sanitize_identifier(request.POST['fullname']), - sanitize_identifier(request.POST['shortname'])) - user = User.objects.get(email=email) + user = create_user(email, "test", user_profile.realm, + sanitize_identifier(request.POST['fullname']), + sanitize_identifier(request.POST['shortname'])) return zephyr_backend(request, user)