Permalink
Browse files

Fix for parent bug

  • Loading branch information...
hackoder committed Oct 31, 2013
1 parent 4031950 commit 267ac23c86118da1933ea169df067ef80b6f3af9
Showing with 5 additions and 0 deletions.
  1. +5 −0 model_mommy/mommy.py
View
@@ -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)):

0 comments on commit 267ac23

Please sign in to comment.