Commit 8ce35488 authored by sim's avatar sim

Add a django custom command callable with manage.py

Call it with: ./manage nodes show
parent 41e22825
from django.core.management.base import BaseCommand, CommandError
from gargantext.tools.show_nodes import tree_show, nodes
import colorama
class Command(BaseCommand):
help = 'Nodes'
def add_arguments(self, parser):
parser.add_argument(dest='action', default='show')
def handle(self, *args, **options):
action = options.get('action')
if action == 'show':
colorama.init(strip=False)
for root in nodes():
tree_show(root)
from django.core.management.base import BaseCommand, CommandError
from gargantext.models import Node
class Command(BaseCommand):
help = 'Something'
def handle(self, *args, **options):
self.stdout.write(self.style.SUCCESS('Oh yeah!'))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment