diff --git a/pairent_backend/pairent_app/factories.py b/pairent_backend/pairent_app/factories.py index db0cd00..e6d046a 100644 --- a/pairent_backend/pairent_app/factories.py +++ b/pairent_backend/pairent_app/factories.py @@ -1,6 +1,6 @@ import factory import random -import time, datetime +import time, datetime, uuid from django.db import models @@ -8,6 +8,10 @@ from pairent_app.models import Apartament, User factory.Faker.override_default_locale('ru_RU'); +class UUID(factory.declarations.BaseDeclaration): + def evaluate(self, instance, step, extra): + return str(uuid.uuid4()).upper(); + class OpenID_Address(factory.declarations.BaseDeclaration): def evaluate(self, instance, step, extra): return ''.join(random.choices(list('abcdef12345678990'), k=6)) + "@vvsu.ru"; @@ -129,5 +133,5 @@ class UserFactory(factory.django.DjangoModelFactory): role = 's' openid_addr = OpenID_Address(); - openid_id = factory.faker.Faker('uuid'); + openid_id = UUID(); photo_provider = Random(0,0,0, ['VVSU', 'GRAVATAR']); \ No newline at end of file