make sure that the commands are operating in the right database

This commit is contained in:
Laura Klünder 2016-08-30 16:05:35 +02:00
parent b314bcae5d
commit c54dcd07d9

View file

@ -3,7 +3,7 @@ import tempfile
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import connections
from django.db import connections, router
class Command(BaseCommand):
@ -22,6 +22,12 @@ class Command(BaseCommand):
'NAME': tmp,
}
# This is not nice, but the easiest way
def tmpdb(*args, **kwargs):
return 'tmpdb'
router.db_for_read = tmpdb
router.db_for_write = tmpdb
try:
call_command('migrate', database='tmpdb')
call_command('loadmap', yes=True)