Commit 27de6840 authored by Okhin's avatar Okhin
Browse files

Let's use a get or create for the tag factory

parent de047352
......@@ -12,6 +12,7 @@ from .models import Article, STATUS_CHOICES
class TagFactory(factory.django.DjangoModelFactory):
class Meta:
model = Tag
django_get_or_create = ('name',)
name = factory.Faker("word")
......@@ -39,11 +40,4 @@ class ArticleFactory(factory.django.DjangoModelFactory):
quote = choice([True, False])
speak = choice([True, False])
def tags(self, create, extracted, **kwargs):
if not create:
if extracted:
for tag in extracted:
tags = factory.RelatedFactoryList(TagFactory, size=lambda: randint(1, 10))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment