Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query using the call_command #70

Open
ssharma80 opened this issue Mar 19, 2019 · 1 comment
Open

query using the call_command #70

ssharma80 opened this issue Mar 19, 2019 · 1 comment

Comments

@ssharma80
Copy link

Could you advise how to use the dump_object command with query programatically using the call_command ?

Consider this
from django.core.management import call_command
q = UploadedFile.objects.filter(user=user).values('pk')
call_command('dump_object', 'validate.UploadedFile', '--no-follow', query=''{"pk__in": ' + str(list(q)) + '}'')

Do sent seem to work ? Any solutions ?

@ghost
Copy link

ghost commented Sep 14, 2020

For everyone stumbling upon the same problem:
I got this to work as follow:

from django.core.management import call_command

ids = tuple(UploadedFile.objects.filter(user=user).values_list('pk', flat=True))

call_command('dump_object', 'validate.UploadedFile', *ids, '--no-follow'')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant