Initial commit from ZIP

This commit is contained in:
kusz committed 2024-11-27 13:18:16 +01:00
commit 378d4692a9
454 files changed
+40367

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import factory
from faker import Factory as FakerFactory
from outbo.apps.projects import models
from tests.factories.organizations import CategoryFactory, BrandFactory
faker = FakerFactory.create()
class ProjectFactory(factory.django.DjangoModelFactory):
name = factory.LazyAttribute(lambda x: faker.sentence())
description = factory.LazyAttribute(lambda x: " ".join(faker.sentences(nb=3)))
category = factory.SubFactory(CategoryFactory)
brand = factory.SubFactory(BrandFactory)
printing_files_date = factory.LazyAttribute(
lambda x: faker.date_between(start_date="today", end_date="+60d")
)
promo_date = factory.LazyAttribute(
lambda x: faker.date_between(start_date="+60d", end_date="+120d")
)
products_amount = factory.LazyAttribute(lambda x: faker.random_int(min=1, max=10))
published = False
@classmethod
def _create(cls, model_class, *args, **kwargs):
manager = cls._get_manager(model_class)
return manager.create(*args, **kwargs)
class Meta:
model = models.Project