Add gen_history django-admin command
This commit is contained in:
parent
97107d9bec
commit
c94841c17b
1 changed files with 16 additions and 0 deletions
16
histories/management/commands/gen_history.py
Normal file
16
histories/management/commands/gen_history.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from profiles import models as profiles
|
||||
from histories.models import generate_history
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
''' Generates an history and prints the related XML '''
|
||||
|
||||
def add_arguments(self, parser):
|
||||
pass
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
prof = profiles.Profile.objects.all()[0]
|
||||
history = generate_history(prof, datetime.now())
|
||||
self.stdout.write(history.to_xml_string())
|
Loading…
Reference in a new issue