The django management decorator package
Project description
Django management command decorator
Small django app to quickly create management commands using a decorating, avoiding writing much boilerplate.
Installation
- Install this package via pip
pip install django_management_command_decorator
- Add
management_command_decorator
to yourINSTALLED_APPS
settings - Create a
commands.py
in your app folder - Add the
django_management_command
decorator to any function in thecommands.py
Usage
Create a commands.py
in your app, and add the following code:
@django_management_command
def print_command():
print("Hello World!")
You should then be able to call the function from your shell like a management command:
% python manage.py print_command
Hello World!
Function args will be added like management command parameters:
@django_management_command
def greet(name):
print(f"Hello {name}!") # noqa: T201
% python manage.py greet Python
Hello Python!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django_management_command_decorator-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73dd6efce34ccf9f87e36248b61968b1be60dbc0d7ff29929e0db6cc3f469b17 |
|
MD5 | 076244dbc3f604de8e4d1775237637dc |
|
BLAKE2b-256 | e067ceb2379c7d2db8c43f00f10893b9606f9a1c9727d81d591b5aceecd1e95b |
Close
Hashes for django_management_command_decorator-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca7f81269d0e7bcd2c1d34b06d035303808b6b8a1dc5ec3469079224757e3ea7 |
|
MD5 | be25e8704e66021d9e6612ebea2649db |
|
BLAKE2b-256 | 3af18e5ee3931b2de516a823aab2df1dd448b60b763c757356ecff4c0917d744 |