The django management decorator package
Project description
Django management command decorator
django_management_command_decorator
is a small Django app to quickly create management commands using a decorator.
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 you wish to expose as a mangement command incommands.py
Usage
Create a commands.py
in your app folder, and add the following code:
from management_command_decorator.decorator import django_management_command
@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:
from management_command_decorator.decorator import django_management_command
@django_management_command
def greet(name):
print(f"Hello {name}!")
% 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
File details
Details for the file django_management_command_decorator-0.0.7.tar.gz
.
File metadata
- Download URL: django_management_command_decorator-0.0.7.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1c7bacb6b26b4855e232161d89e53a5e741ed49b0028ae7d0e0ca84a0cdeac0 |
|
MD5 | c8540e501d49537710d27de0084fdb62 |
|
BLAKE2b-256 | 727e6f881d55a6f5be53d4d64f41f49ba0c913258729f919b425d9601e8a9658 |
File details
Details for the file django_management_command_decorator-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: django_management_command_decorator-0.0.7-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 815442ebb6d2d269f168d0e2f9b89e857f866ebbddf883c8336850e534de2673 |
|
MD5 | f3d356720283a069147d4526807076fd |
|
BLAKE2b-256 | 94362c8572c2ca48100550624f77d5c30ca7e7b9cc2d0a54a5cc85924bebf212 |