Files
Aleksandr Meshchriakov 8ed3e1175c
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 5m5s
CI/CD Pipeline / Run Tests (push) Failing after 5m5s
CI/CD Pipeline / Build Docker Images (push) Has been skipped
CI/CD Pipeline / Push to Gitea Registry (push) Has been skipped
CI/CD Pipeline / Deploy to Server (push) Has been skipped
Add initial implementations for forms and organization apps with serializers, factories, and admin configurations
2026-02-17 09:26:08 +01:00

26 lines
796 B
Python

"""Factories for organization app."""
import factory
from apps.organization.models import Organization
from faker import Faker
fake = Faker("ru_RU")
class OrganizationFactory(factory.django.DjangoModelFactory):
"""Factory for Organization model."""
class Meta:
model = Organization
name = factory.LazyAttribute(lambda _: fake.company())
inn = factory.LazyAttribute(lambda _: fake.numerify("##########"))
ogrn = factory.LazyAttribute(lambda _: fake.numerify("#############"))
kpp = factory.LazyAttribute(lambda _: fake.numerify("#########"))
okpo = factory.LazyAttribute(lambda _: fake.numerify("########"))
@classmethod
def create_organization(cls, **kwargs):
"""Create organization with defaults."""
return cls.create(**kwargs)