regluit/core/management/commands/doab_load_auths.py

17 lines
568 B
Python
Raw Normal View History

2016-11-29 20:37:02 +00:00
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from regluit.core.loaders import doab
class Command(BaseCommand):
help = "load doab auths"
args = "<limit> <file_name>"
def handle(self, limit=None, file_name="../../../bookdata/doab_auths.json", **options):
command_dir = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(command_dir, file_name)
doab.load_doab_auths(file_path, limit=int(limit) if limit else None)