我将创建一个关于使用谷歌应用引擎管理和跟踪我的钱的网站。
但我遇到了一些问题。就像我如何通过在数据存储中使用查询来表示我的钱
这是我的代码,我不知道如何处理 sum_deal 的东西
感谢观看 :)
class BlogHandler(webapp2.RequestHandler):
def write(self, *a, **kw):
self.response.out.write(*a, **kw)
def render_str(self, template, **params):
params['user'] = self.user
return render_str(template, **params)
def render(self, template, **kw):
self.write(self.render_str(template, **kw))
class Book(db.Model):
deal = db.FloatProperty(required= True)
created = db.DateTimeProperty(auto_now_add=True)
sum_deal = db.FloatProperty
class BookMe(BlogHandler):
def render_book(self, deal="",sum_deal=""):
deals = db.GqlQuery("SELECT * FROM Book ORDER BY created DESC")
self.render("book.html", deal=deal, sum_deal=sum_deal,deals = deals)
def get(self):
render_book()
def post(self):
deal = self.request.get("deal")
if deal:
b = Book(deal = deal)
b.put()
self.redirect("/")