Skip to content

Commit

Permalink
added no-follow option to dump_object
Browse files Browse the repository at this point in the history
  • Loading branch information
koryd-bixly authored and davedash committed Feb 3, 2017
1 parent 4c089c3 commit e0442bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fixture_magic/management/commands/dump_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def add_arguments(self, parser):
dest='query', default=None,
help=('Use a json query rather than list of ids '
'e.g. \'{\"pk__in\": [id, ...]}\''))
parser.add_argument('--no-follow',
action='store_false', dest='follow_fk',
default=True,
help='serializes Foriegn Keys related to object')

parser.add_argument(
'--format', default='json', dest='format',
Expand Down Expand Up @@ -115,7 +119,8 @@ def handle(self, *args, **options):
pass

add_to_serialize_list(objs)
serialize_fully()
if options.get('follow_fk', True):
serialize_fully()
self.stdout.write(serialize(options.get('format','json'), [o for o in serialize_me if o is not None],
indent=4,
use_natural_foreign_keys=options.get('natural', False),
Expand Down

0 comments on commit e0442bf

Please sign in to comment.