Get the just-created user from create_user

(imported from commit d709c99cc670aa1b0864c40b8c0d5e52b6c90340)
This commit is contained in:
Keegan McAllister 2012-09-21 14:01:43 -04:00
parent 0638c2aada
commit a68a3e7ab7
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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)