Example #1
0
 def get(self):
     json = []
     for m in Ad.all():
         if m.image:
             json.append({
                 'title': m.title,
             })
             image_thumb = images.resize(m.image, 100, 100)
             image_medium = images.resize(m.image, 480, 480)
             image_small = images.resize(m.image, 200, 200)
             m.image_thumb = db.Blob(image_thumb)
             m.image_small = db.Blob(image_small)
             m.put()
     for m in Billboard.all():
         if m.image:
             json.append({
                 'title': m.title,
             })
             image_thumb = images.resize(m.image, 100, 100)
             image_medium = images.resize(m.image, 480, 480)
             image_small = images.resize(m.image, 200, 200)
             m.image_thumb = db.Blob(image_thumb)
             m.image_small = db.Blob(image_small)
             m.put()
     json = simplejson.dumps(json)
     self.response.headers.add_header('Content-Type', 'application/json')
     self.response.out.write(json)
Example #2
0
 def get(self):
     args = {
         'ads': Ad.all().order('-created').fetch(100),
         'billboards': Billboard.all().order('-created').fetch(100),
         'body_id': 'billboards_page',
         'GOOGLE_ANALYTICS_ACCOUNT': GOOGLE_ANALYTICS_ACCOUNT,
     }
     path = os.path.join(os.path.dirname(__file__), 'billboards.html')
     self.response.out.write(template.render(path, args))