Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for parent bug

  • Loading branch information...
commit 267ac23c86118da1933ea169df067ef80b6f3af9 1 parent 4031950
@hackoder hackoder authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 model_mommy/mommy.py
View
5 model_mommy/mommy.py
@@ -256,6 +256,11 @@ def _make(self, commit=True, **attrs):
self.rel_fields = [x.split('__')[0] for x in self.rel_attrs.keys() if is_rel_field(x)]
for field in self.get_fields():
+
+ # Skip links to parent so parent is not created twice.
+ if isinstance(field, OneToOneField) and field.rel.parent_link:
+ continue
+
field_value_not_defined = field.name not in model_attrs
if isinstance(field, (AutoField, generic.GenericRelation)):
Please sign in to comment.
Something went wrong with that request. Please try again.