mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 05:14:00 +02:00
brmbar.Account.create(): Fix SQL usage
This commit is contained in:
parent
8ed210bac9
commit
a775c24cbc
1 changed files with 1 additions and 1 deletions
|
@ -50,7 +50,7 @@ class Account:
|
||||||
def create(cls, db, name, currency, acctype):
|
def create(cls, db, name, currency, acctype):
|
||||||
""" Constructor for new account """
|
""" Constructor for new account """
|
||||||
with closing(db.cursor()) as cur:
|
with closing(db.cursor()) as cur:
|
||||||
cur.execute("INSERT INTO accounts (name, currency, acctype) VALUES (%s, %s, %s) RETURNING id", [name, currency, acctype])
|
cur.execute("INSERT INTO accounts (name, currency, acctype) VALUES (%s, %s, %s) RETURNING id", [name, currency.id, acctype])
|
||||||
id = cur.fetchone()[0]
|
id = cur.fetchone()[0]
|
||||||
return cls(db, name = name, id = id, currency = currency, acctype = acctype)
|
return cls(db, name = name, id = id, currency = currency, acctype = acctype)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue