Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RouteDetails(ndb.Model):
- """Get list of routes from Datastore """
- RouteName = ndb.StringProperty()
- @classmethod
- def query_routes(cls):
- return cls.query().order(-cls.RouteName)
- class RoutesPage(webapp2.RequestHandler):
- def get(self):
- adminLink = authenticate.get_adminlink()
- authMessage = authenticate.get_authmessage()
- self.output_routes(authMessage,adminLink)
- def output_routes(self,authMessage,adminLink):
- self.response.headers['Content-Type'] = 'text/html'
- html = templates.base
- html = html.replace('#title#', templates.routes_title)
- html = html.replace('#authmessage#', authMessage)
- html = html.replace('#adminlink#', adminLink)
- html = html.replace('#content#', '')
- self.response.out.write(html + '<ul>')
- list_name = self.request.get('list_name')
- #version_key = ndb.Key("List of routes", list_name or "*notitle*")
- routes = RouteDetails.query_routes().fetch(20)
- for route in routes:
- routeLink = '<a href="route_instance?key={}">{}</a>'.format(
- route.Key, route.RouteName)
- self.response.out.write('<li>' + routeLink + '</li>')
- self.response.out.write('</ul>' + templates.footer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement