Skip to content

Commit

Permalink
Quick and dirty compat fix for django 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Jaworski authored and davedash committed Feb 9, 2017
1 parent ee67754 commit 9c85a13
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions fixture_magic/management/commands/dump_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,16 @@ def handle(self, *args, **options):
fields = (f for f in dump_me._meta.get_fields()
if (f.one_to_many or f.one_to_one) and f.auto_created)
else:
fields = dump_me._meta.get_all_related_objects()

related_fields = [rel.get_accessor_name() for rel in
fields]
try:
fields = dump_me._meta.get_all_related_objects()
except AttributeError:
fields = [
f for f in dump_me._meta.get_fields()
if (f.one_to_many or f.one_to_one)
and f.auto_created and not f.concrete
]

related_fields = [rel.get_accessor_name() for rel in fields]

for obj in objs:
for rel in related_fields:
Expand Down

0 comments on commit 9c85a13

Please sign in to comment.