Skip to content

Difficulty Parsing Multiple Arguments in Admin Interface #2

Description

@mahdijafaridev

Issue Summary:

When using django-admin-commands2 to run a management command with multiple parameters from the Django admin interface, the command fails to execute correctly. It appears that the single input field provided for arguments (args = forms.CharField(required=False, label=_('Arguments to send to command'))) is not correctly parsing or passing multiple arguments to the management command.

Command Details:

The management command in my project requires two arguments: --from-date (a date string) and --step (an integer). The command is implemented in Django and works as expected when run from the command line.

What I did:

  • Navigate to the Django admin interface where the command is listed.
  • In the provided text field for arguments, enter the arguments in various formats (e.g., --from-date="2021-01-01" --step=5, --from-date "2021-01-01" --step 5, etc.).
  • Execute the command.
  • The command does not run successfully and reports a missing --step argument.

Expected Behavior:

The admin interface should correctly parse and pass multiple arguments to the management command.

Actual Behavior:

The command fails with an error indicating that the --step argument is missing, regardless of how the arguments are formatted in the input field.
Environment:

Django Version: 3.2
django-admin-commands2 Version: 1.1.3
Python Version: 3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions