joke2k / django-faker

Django-faker uses fake-factory to generate test data for Django models and templates
MIT License
245 stars 48 forks source link

For foreignkey fields get error with 'rel' attribute #27

Open clikman007 opened 6 years ago

clikman007 commented 6 years ago

Use djnago 2.0, rel attr depricated since version 1.9

$ populator.addEntity(Patient, 2)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/user/www/virt_env/lib/python3.5/site-packages/django_faker/populator.py", line 138, in addEntity
    model.fieldFormatters = model.guessFieldFormatters( self.generator )
  File "/home/user/www/virt_env/lib/python3.5/site-packages/django_faker/populator.py", line 65, in guessFieldFormatters
    relatedModel = field.rel.to
AttributeError: 'ForeignKey' object has no attribute 'rel'
david-wizzili commented 6 years ago

I've fixed this in a separate branch for now (https://github.com/david-wizzili/django-faker)

@joke2k , please feel free to pull what's there if it's OK with you.