You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class MyAuthorFactory(factory.django.DjangoModelFactory):
full_name = 'John Doe'
original_author = factory.SubFactory('app.factories.MyAuthorFactory')
class Meta:
model = 'app.models.Author'
True. Try using a related_name in the model and the following in the factory: factory.RelatedFactory('app.factories.MyAuthorFactory', factory_related_name='parent')
It seems to be that
SubFactory
does not work with self-referencing ForeignKey relationships. I have a model with a foreign key toself
:This is the factory I tried to use:
I registered the factory like this:
And got this error:
The text was updated successfully, but these errors were encountered: