diff --git a/fixture_magic/management/commands/custom_dump.py b/fixture_magic/management/commands/custom_dump.py index dbe2783..21f3d53 100644 --- a/fixture_magic/management/commands/custom_dump.py +++ b/fixture_magic/management/commands/custom_dump.py @@ -29,7 +29,7 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('dump_name') - parser.add_argument('pk', nargs='+') + parser.add_argument('pk', nargs='*') parser.add_argument('--natural', default=False, action='store_true', dest='natural', help='Use natural keys if they are available.') @@ -40,8 +40,11 @@ def handle(self, *args, **options): dump_settings = settings.CUSTOM_DUMPS[dump_name] (app_label, model_name) = dump_settings['primary'].split('.') include_primary = dump_settings.get("include_primary", False) - dump_me = loading.get_model(app_label, model_name) - objs = dump_me.objects.filter(pk__in=[int(i) for i in pks]) + dump_me = loading.get_model(app_label, model_name).objects + if pks: + objs = dump_me.filter(pk__in=pks) + else: + objs = dump_me for obj in objs.all(): # get the dependent objects and add to serialize list for dep in dump_settings['dependents']: