Simpler fix
This commit is contained in:
parent
510570521d
commit
250e045ec3
|
@ -27,7 +27,7 @@ class GroupFactory(factory.django.DjangoModelFactory):
|
||||||
django_get_or_create = ('acronym',)
|
django_get_or_create = ('acronym',)
|
||||||
skip_postgeneration_save = True
|
skip_postgeneration_save = True
|
||||||
|
|
||||||
name = factory.Faker('sentence',nb_words=6)
|
name = factory.Faker('text', max_nb_chars=80)
|
||||||
acronym = factory.Sequence(lambda n: 'acronym%d' %n)
|
acronym = factory.Sequence(lambda n: 'acronym%d' %n)
|
||||||
state_id = 'active'
|
state_id = 'active'
|
||||||
type_id = 'wg'
|
type_id = 'wg'
|
||||||
|
@ -35,13 +35,6 @@ class GroupFactory(factory.django.DjangoModelFactory):
|
||||||
uses_milestone_dates = True
|
uses_milestone_dates = True
|
||||||
used_roles = [] # type: List[str]
|
used_roles = [] # type: List[str]
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _create(cls, model_class, *args, **kwargs):
|
|
||||||
obj = model_class(*args, **kwargs)
|
|
||||||
obj.name = obj.name[0:80] # db only allows names of 80 characters max
|
|
||||||
obj.save()
|
|
||||||
return obj
|
|
||||||
|
|
||||||
@factory.lazy_attribute
|
@factory.lazy_attribute
|
||||||
def parent(self):
|
def parent(self):
|
||||||
if self.type_id in ['wg','ag']:
|
if self.type_id in ['wg','ag']:
|
||||||
|
|
Loading…
Reference in a new issue