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 feeds(): feed_list = Feedback.select() return render_template("feedback/list.html", feeds=feed_list)
def random_feed(): user = random.choice(user_list) content = " ".join(random_name(10)) feed = Feedback.create(user=user, content=content) return feed