wrap UserManager.create_user in a transaction
This commit is contained in:
parent
11baf6bace
commit
6984033444
1 changed files with 2 additions and 1 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue