#30098: Permit using packages (directories) in custom django-admin commands.
-------------------------------------+-------------------------------------
Reporter: Andrey | Owner: Andrey Volkov
Volkov |
Type: New | Status: assigned
feature |
Component: Core | Version: 2.1
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Current Django behavior is that only files are allowed for custom django-
admin commands definition. It would be great if Django permitted
directories (see example below).
Current (required) style:
{{{
app_example/management/commands
├── first_command.py
└── second_command.py
}}}
New style:
{{{
app_example/management/commands
├── first_command
│ ├── __init__.py
│ └── some_useful_data
└── second_command
└── __init__.py
}}}
Or combined style:
{{{
app_example/management/commands
├── first_command
│ ├── __init__.py
│ └── some_useful_data
└── second_command.py
}}}
This feature allows developers to use additional files (some_useful_data
is this case) in structured way, also providing encapsulation.
The only code to be changed is in file
`django/core/management/__init__.py` line 27:
From `if not is_pkg and not name.startswith('_')]`
To `if not name.startswith('_')]`
After this change, function `find_commands` won't ignore packages
(directories).
Also, backward compatibility will be saved (because single files work in
the same way).
--
Ticket URL: <https://code.djangoproject.com/ticket/30098>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.9db38e6d4f7226c76f6f8ec1ec543dc5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.