Use SF_EXAMPLE_SIMPLE_DEFAULTS to remove DefaulteOnCreate owner from non sf tests
@@ -135,6 +135,7 @@ class Contact(SalesforceModel):
# The `default=` with lambda function is easy readable, but can be
# problematic with migrations in the future because it is not serializable.
# It can be replaced by normal function.
+ if not getattr(settings, 'SF_EXAMPLE_SIMPLE_DEFAULTS', False):
owner = models.ForeignKey(User, on_delete=models.DO_NOTHING,
default=models.DefaultedOnCreate(User),
related_name='contact_owner_set')
@@ -191,6 +192,7 @@ class Lead(SalesforceModel):
sf_read_only=models.NOT_CREATEABLE)
# Deleted object can be found only in querysets with "query_all" SF method.
IsDeleted = models.BooleanField(default=False, sf_read_only=models.READ_ONLY)
+ if not getattr(settings, 'SF_EXAMPLE_SIMPLE_DEFAULTS', False):
owner = models.ForeignKey(User, on_delete=models.DO_NOTHING,
default=models.DefaultedOnCreate(User),
related_name='lead_owner_set')
