error:
in run insertedPks = populator.execute()
File "/usr/local/lib/python2.7/dist-packages/django_faker/populator.py", line 163, in execute
insertedEntities[klass].append( self.entities[klass].execute(using, insertedEntities) )
File "/usr/local/lib/python2.7/dist-packages/django_faker/populator.py", line 105, in execute
setattr(obj, field, value)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 405, in set
self.field.name, self.field.rel.to._meta.object_name))
ValueError: Cannot assign "": "Personages.act_born_id" must be a "ActsBorn" instance.
model: class Personages(models.Model): name = models.CharField(max_length=200) act_born_id = models.ForeignKey('ActsBorn') act_death_id = models.ForeignKey('ActsDeath', null=True)
faker: populator = Faker.getPopulator() populator.addEntity(ActsDeath,30, { 'death_location': lambda x: populator.generator.format('address'), }) populator.addEntity(ActsBorn,30, { 'name': lambda x: populator.generator.format('name'), 'born_location': lambda x: populator.generator.format('address'), }) populator.addEntity(Personages,30, { 'name': lambda x: populator.generator.format('name'), })
insertedPks = populator.execute()
error: in run insertedPks = populator.execute() File "/usr/local/lib/python2.7/dist-packages/django_faker/populator.py", line 163, in execute insertedEntities[klass].append( self.entities[klass].execute(using, insertedEntities) ) File "/usr/local/lib/python2.7/dist-packages/django_faker/populator.py", line 105, in execute setattr(obj, field, value) File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 405, in set self.field.name, self.field.rel.to._meta.object_name)) ValueError: Cannot assign "": "Personages.act_born_id" must be a "ActsBorn" instance.