From 39e1d4ef084a88d9d9a3b9f114846cc91f9bedda Mon Sep 17 00:00:00 2001 From: oysteini Date: Tue, 11 May 2010 15:30:13 +0000 Subject: [PATCH] Endret strekkodekolonnen til teksttype i databasen. --- db.py | 2 +- text_based.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db.py b/db.py index c9bd880..366e114 100644 --- a/db.py +++ b/db.py @@ -33,7 +33,7 @@ class User(Base): class Product(Base): __tablename__ = 'products' - bar_code = Column(Integer, primary_key=True) + bar_code = Column(String(13), primary_key=True) name = Column(String(30)) price = Column(Integer) diff --git a/text_based.py b/text_based.py index f32126d..c8fbcf5 100644 --- a/text_based.py +++ b/text_based.py @@ -360,7 +360,7 @@ class AddProductMenu(Menu): def _execute(self): self.session = Session() self.print_header() - bar_code = self.input_int('Bar code> ') + bar_code = self.input_str('Bar code> ', Product.bar_code_re, (8,13)) name = self.input_str('Name> ', Product.name_re, (1,30)) price = self.input_int('Price> ', (1,100000)) product = Product(bar_code, name, price)