def create_db(): try: User.drop_table() Member.drop_table() Commodity.drop_table() Category.drop_table() UserOrder.drop_table() OrderItem.drop_table() CommodityImage.drop_table() CommodityComment.drop_table() Address.drop_table() OrderStatus.drop_table() Announcement.drop_table() Feedback.drop_table() except: pass User.create_table() Member.create_table() Commodity.create_table() Category.create_table() UserOrder.create_table() OrderItem.create_table() CommodityImage.create_table() CommodityComment.create_table() Address.create_table() OrderStatus.create_table() Announcement.create_table() Feedback.create_table()
def travel_comment(writer): comments = CommodityComment.select() for com in comments: writer.add_document(type=u"CommodityComment", id=unicode(com.commodity.id), title=unicode(com.commodity.name.lower()), content=unicode(com.comment.lower()))
def comment(comment_id): comment = CommodityComment.select().get(id=comment_id) return render_template('commodity/item_comment.html', user=g.user, comment=comment)