Do not hardcode database name and owner
This commit is contained in:
parent
2571477bb4
commit
146260b358
|
@ -231,13 +231,16 @@ class Command(BaseCommand):
|
||||||
parser.add_argument('-b', '--boutons', action = 'store_true', help="import boutons")
|
parser.add_argument('-b', '--boutons', action = 'store_true', help="import boutons")
|
||||||
parser.add_argument('-t', '--transactions', action = 'store_true',help="import transaction")
|
parser.add_argument('-t', '--transactions', action = 'store_true',help="import transaction")
|
||||||
parser.add_argument('-a', '--aliases', action = 'store_true',help="import aliases")
|
parser.add_argument('-a', '--aliases', action = 'store_true',help="import aliases")
|
||||||
|
parser.add_argument('-d', '--nk15db', action='store', default='nk15', help='NK15 database name')
|
||||||
|
parser.add_argument('-u', '--nk15user', action='store', default='nk15_user', help='NK15 database owner')
|
||||||
|
|
||||||
def handle(self, *args, **kwargs):
|
def handle(self, *args, **kwargs):
|
||||||
|
nk15db, nk15user = kwargs['nk15db'], kwargs['nk15user']
|
||||||
#reset database.
|
#reset database.
|
||||||
call_command("flush")
|
call_command("flush")
|
||||||
self.print_success("flush nk20 database")
|
self.print_success("flush nk20 database")
|
||||||
# connecting to nk15 database
|
# connecting to nk15 database
|
||||||
conn = pg.connect(database="nk15",user="nk15_user")
|
conn = pg.connect(database=nk15db,user=nk15user)
|
||||||
cur = conn.cursor(cursor_factory = pge.DictCursor)
|
cur = conn.cursor(cursor_factory = pge.DictCursor)
|
||||||
|
|
||||||
if kwargs["special"]:
|
if kwargs["special"]:
|
||||||
|
|
Loading…
Reference in New Issue