brmbarv3 ItemEdit: Fix missing support for renaming items

This commit is contained in:
Petr Baudis 2012-09-28 23:21:23 +02:00
parent 278a869ba3
commit b11cd6c338
2 changed files with 7 additions and 0 deletions

View file

@ -82,3 +82,8 @@ class Account:
def add_barcode(self, barcode):
with closing(self.db.cursor()) as cur:
cur.execute("INSERT INTO barcodes (account, barcode) VALUES (%s, %s)", [self.id, barcode])
def rename(self, name):
with closing(self.db.cursor()) as cur:
cur.execute("UPDATE accounts SET name = %s WHERE id = %s", [name, self.id])
self.name = name