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')
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)
def get(self): for p in Pub.all().run(): if not p.latitude: p.delete() self.response.out.write('success')