Less DB queries in test factories

This commit is contained in:
Eliot Berriot 2019-01-04 14:36:08 +01:00
parent b6902009ac
commit d4eff5aa32
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
9 changed files with 61 additions and 54 deletions

View file

@ -28,3 +28,14 @@ def ManyToManyFromList(field_name):
field.add(*extracted)
return inner
class NoUpdateOnCreate:
"""
Factory boy calls save after the initial create. In most case, this
is not needed, so we disable this behaviour
"""
@classmethod
def _after_postgeneration(cls, instance, create, results=None):
return