refactor models, change map package storage and map package loading
This commit is contained in:
parent
0656090f27
commit
376d85f9b4
12 changed files with 226 additions and 150 deletions
|
@ -1,19 +1,19 @@
|
|||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db import transaction
|
||||
from ...packageio import MapPackagesIO
|
||||
|
||||
from ...packageio import read_packages
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Load the given map packages into the database'
|
||||
help = 'Update the map database'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('mappkgdir', nargs='+', type=str, help='map package directories')
|
||||
parser.add_argument('-y', action='store_const', const=True, default=False,
|
||||
help='don\'t ask for confirmation')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
with transaction.atomic():
|
||||
MapPackagesIO(options['mappkgdir']).update_to_db()
|
||||
read_packages()
|
||||
print()
|
||||
if input('Confirm (y/N): ') != 'y':
|
||||
raise CommandError('Aborted.')
|
Loading…
Add table
Add a link
Reference in a new issue