Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (21 sloc) 660 Bytes
import time
import webapp2
from google.appengine.ext import ndb
class Book(ndb.Model):
name = ndb.StringProperty()
class CreateHandler(webapp2.RequestHandler):
def get(self):
name = self.request.get('name', 'gae_{}'.format(time.time()))
book_key = Book(name=name).put()
class ListHandler(webapp2.RequestHandler):
def get(self):
books = Book.query().fetch()
out = ''
for b in books:
out += '<p>{}</p>'.format(b)
app = webapp2.WSGIApplication([
('/', ListHandler),
('/create', CreateHandler),
], debug=True)
You can’t perform that action at this time.