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

Allow list_model_info with to target multiple --models from the commandline #1792

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cb109
Copy link

@cb109 cb109 commented Jan 19, 2023

I wanted to output the list_model_info for some of our models (we have hundreds), but currently can a) either output all of them or b) call the command once per --model. I found that non-intuitive and would much prefer to be able to specify the desired models in a single command.

This PR changes list_model_info --model app.Model to list_model_info --models app1.Model1,app2.Model2,app3.Model3.

Since Django's management commands use argparse with a forgiving CLI option config, the old --model option will still work the exact same way as before (as it will match to the new --models), thus the change is backwards compatible.

Maybe it's worth thinking about something like this? The API could be different (e.g. support using --model more than once, or
handle multiple arguments, or a separate option).

It can then be used like:

    python manage.py list_info_model --models app1.Model1,app2.Model2

Since Django's management commands use argparse with a forgiving CLI
option config, the old --model option will still work the exact same
way as before (as it will match to the new --models), thus the change is
backwards compatible.
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

Successfully merging this pull request may close these issues.

None yet

1 participant