Endret strekkodekolonnen til teksttype i databasen.

This commit is contained in:
Øystein Ingmar Skartsæterhagen 2010-05-11 15:30:13 +00:00
parent dcb249991b
commit 39e1d4ef08
2 changed files with 2 additions and 2 deletions

2
db.py
View File

@ -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)

View File

@ -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)