Пример #1
0
def home():
  query = Occupant.query()
  tmp_vendors = convertVendors(query)
  vendors = {'vendors':tmp_vendors}

  #query = Spot.query()
  #query_spots = convertSpots(query)
  tmp_spots = []

  for v in tmp_vendors:
    spot = Spot.get_by_id(v['spot_id'])
    if spot != None:
      tmp = convertOneSpot(spot,v)
      tmp_spots.append(tmp)

  spots = {'spots':tmp_spots}

  header = template('header', home="active", vendor="", edit="", about="")
  content = template('buyer', vendors, spots)
  footer = template('footer',"")
  deleted = """
  <script>
    $(window).load(function() {
    alert("The spot entered and it's information has been deleted. \\n\\nThank you!");
    });
  </script>"""
  confirmation = """
  <script>
    $(window).load(function() {
    alert("Your reservation is complete! Please note that official reservations must be made through the Student Center and not through antTrails. Also, please note that the spots reset at 12am everyday. \\n\\nThank you!");
    });
  </script>
  """

  if request.get_cookie("submittedForm") == "yes":
    response.set_cookie("submittedForm", "no")
    content = template('buyer', vendors, spots)
    return header + content + footer + confirmation
  elif request.get_cookie("deleted") == "yes":  
    response.set_cookie("deleted", "no")
    content = template('buyer', vendors, spots)
    return header + content + footer + deleted
  else:
    return header + content + footer 
Пример #2
0
from bottle import Bottle,route, run, template, static_file, get, post, request, redirect, response
from antTrailsDatabase import Occupant, Spot
from google.appengine.ext import ndb
import datetime, pyimgur, time

ndb.delete_multi(Occupant.query().fetch(keys_only=True))
return 250