Ejemplo n.º 1
0
 def get(self):
   pubs = Pub.all().run()
   for p in pubs:
     if ' College' in p.name or ' Hall' in p.name:
       p.is_college = True
       p.put()
   self.response.out.write('success')
Ejemplo n.º 2
0
 def get(self):
   pub_id = int(self.request.get('pub'))
   pub = Pub.get_by_id(pub_id)
   visits = Visit.all().filter('pub =', pub).run()
   for v in visits:
     v.delete()
   pub.delete()
Ejemplo n.º 3
0
  def post(self):
    name = self.request.get('name')
    p = Pub.all().filter('name =', name).get(keys_only=True)
    if p:
      self.response.out.write('already exists')
      return
    nlat = None
    nlong = None
    lat = self.request.get('lat')
    long = self.request.get('long')
    if lat:
      nlat = float(lat)
    if long:
      nlong = float(long)
    p = Pub(name=name, latitude=nlat, longitude=nlong)
    p.put()

    users = User.all().run()
    for u in users:
      v = Visit(parent=u, pub=p)
      v.put()
    self.response.out.write('added ' + name)
Ejemplo n.º 4
0
 def get(self):
   pub_id = int(self.request.get('pub'))
   pub = Pub.get_by_id(pub_id)
   pub.closed = True
   pub.put()
Ejemplo n.º 5
0
 def get(self):
   for p in Pub.all().run():
     if not p.latitude:
       p.delete()
   self.response.out.write('success')