wrap UserManager.create_user in a transaction

This commit is contained in:
Jan Dittberner 2014-12-17 22:19:44 +01:00
parent 11baf6bace
commit 6984033444

View file

@ -1,7 +1,7 @@
from datetime import date from datetime import date
import os import os
from django.db import models from django.db import models, transaction
from django.conf import settings from django.conf import settings
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils import timezone from django.utils import timezone
@ -176,6 +176,7 @@ class UserManager(models.Manager):
break break
return nextuser return nextuser
@transaction.atomic
def create_user(self, username=None, password=None, commit=False): def create_user(self, username=None, password=None, commit=False):
uid = self.get_next_uid() uid = self.get_next_uid()
gid = Group.objects.get_next_gid() gid = Group.objects.get_next_gid()