Permalink
Browse files

modified: models.py

modified:   views.py
  • Loading branch information...
1 parent def5545 commit a558c5677afcc34f196526167b589cb3feb414b3 davidx committed Jun 3, 2010
Showing with 13 additions and 13 deletions.
  1. +12 −12 davidblog/models.py
  2. +1 −1 davidblog/views.py
View
@@ -21,9 +21,9 @@ class Comment(Base):
id = Column(Integer, primary_key=True)
entry_id = Column(Integer, ForeignKey('entries.id'))
- email = Column(String)
- username = Column(String)
- url = Column(String)
+ email = Column(String(50))
+ username = Column(String(50))
+ url = Column(String(50))
comment = Column(Text)
created_time = Column(DateTime)
@@ -39,8 +39,8 @@ class Entry(Base):
__tablename__ = 'entries'
id = Column(Integer, primary_key=True)
- title = Column(String)
- slug = Column(String, unique=True)
+ title = Column(String(255))
+ slug = Column(String(255), unique=True)
content = Column(Text)
created_time = Column(DateTime, default=datetime.now())
modified_time = Column(DateTime, default=datetime.now())
@@ -64,7 +64,7 @@ class Tag(Base):
__tablename__ = 'tags'
id = Column(Integer, primary_key=True)
- name = Column(String, unique=True)
+ name = Column(String(50), unique=True)
entry_num = Column(Integer, default=0)
def __init__(self, name):
@@ -77,8 +77,8 @@ class Page(Base):
__tablename__ = 'pages'
id = Column(Integer, primary_key=True)
- title = Column(String)
- slug = Column(String, unique=True)
+ title = Column(String(255))
+ slug = Column(String(255), unique=True)
content = Column(Text)
created_time = Column(DateTime, default=datetime.now())
modified_time = Column(DateTime, default=datetime.now())
@@ -95,16 +95,16 @@ class Link(Base):
__tablename__ = 'links'
id = Column(Integer, primary_key=True)
- name = Column(String)
- url = Column(String)
+ name = Column(String(45))
+ url = Column(String(45))
created_time = Column(DateTime)
class Admin(Base):
__tablename__ = 'admins'
id = Column(Integer, primary_key=True)
- username = Column(String)
- password = Column(String)
+ username = Column(String(45))
+ password = Column(String(45))
if __name__ == "__main__":
metadata.create_all(engine)
View
@@ -54,7 +54,7 @@ def GET(self):
#randomEntries = [web.ctx.orm.query(Entry).filter_by(id=id).first() for id in random.sample(ids, 5)]
entryCount = web.ctx.orm.query(Entry).count()
p = Pagination(entryCount, 5, int(i.page))
- d['entries'] = web.ctx.orm.query(Entry).order_by('entries.createdTime DESC')[p.start:p.start + p.limit]
+ d['entries'] = web.ctx.orm.query(Entry).order_by('entries.created_time DESC')[p.start:p.start + p.limit]
d['p'] = p
d['usedTime'] = time.time() - d['startTime']
#d['randomEntries'] = randomEntries

0 comments on commit a558c56

Please sign in to comment.