#25736: Define management commands via function
--------------------------------------------+--------------------
Reporter: olethanh | Owner: nobody
Type: New feature | Status: new
Component: Core (Management commands) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------------+--------------------
Creating a new management command currently require a lot of boilerplate
to remember, a small part of it is having to subclass a command. This is
often overkill when you just have a function and don't need complex
arguments parsing.
So I'm proposing to allow using function for Command.
I'm attaching an idea of an implementation but I'm not really set on it.
This would allow to write:
{{{
from django.core.management.base import LabelCommand
def print_label(label):
"Help message"
print label
Command = LabelCommand.from_func(print_label,
can_import_settings=False)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25736>
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/051.7aee36acb2701e97e2ecfbffa58ffb38%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.