Disable scopes for all unique ID generation

This commit is contained in:
Raphael Michel
2019-06-17 14:05:05 +02:00
parent d716f7e014
commit 4b65b94bd5
5 changed files with 10 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ from django.db.models import Q
from django.utils.crypto import get_random_string
from django.utils.timezone import now
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
from django_scopes import ScopedManager
from django_scopes import ScopedManager, scopes_disabled
from ..decimal import round_decimal
from .base import LoggedModel
@@ -24,6 +24,7 @@ def _generate_random_code(prefix=None):
return get_random_string(length=settings.ENTROPY['voucher_code'], allowed_chars=charset)
@scopes_disabled()
def generate_code(prefix=None):
while True:
code = _generate_random_code(prefix=prefix)