Skip to content

Commit

Permalink
Merge 473cbdb into 5b7be28
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurensBosscher committed Dec 30, 2015
2 parents 5b7be28 + 473cbdb commit e53a10f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions django_seed/seeder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django_seed.exceptions import SeederException
from django.db.models.fields import AutoField
from django.db.models import ForeignKey, ManyToManyField, OneToOneField
from django.contrib.contenttypes.models import ContentType


class ModelSeeder(object):
Expand Down Expand Up @@ -38,6 +39,14 @@ def guess_field_formatters(self, faker):

for field in model._meta.fields:
field_name = field.name

if field_name.endswith('_ptr'):
continue

if field_name == 'polymorphic_ctype':
formatters[field_name] = ContentType.objects.get_for_model(model)
continue

if isinstance(field, (ForeignKey, ManyToManyField, OneToOneField)):
formatters[field_name] = self.build_relation(field, field.rel.to)
continue
Expand Down

0 comments on commit e53a10f

Please sign in to comment.