Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

management command in django

from django.core.management.base import BaseCommand
from django.utils import timezone

class Command(BaseCommand):
    help = 'Displays current time'

    def handle(self, *args, **kwargs):
        time = timezone.now().strftime('%X')
        self.stdout.write("It's now %s" % time)
Source by simpleisbetterthancomplex.com #
 
PREVIOUS NEXT
Tagged: #management #command #django
ADD COMMENT
Topic
Name
3+5 =