Ejemplo n.º 1
0
    def post(self, recoms_id):
        user = users.get_current_user()

        if not user:
            self.render_template(
                "permissiondenied.html",
                params={"login_url": users.create_login_url('/')})
            return

        rename = self.request.get("name")  # name of the Restaurant
        restreet = self.request.get("street")  # street of the Restaurant
        replz = self.request.get("plz")  # post code of the Restaurant
        replace = self.request.get("ort")  # town/city of the Restaurant
        reinfo = self.request.get("info")  # Note Text of the Restaurant
        revisit = self.request.get("visit")  # Visit time of the Restaurant
        price = int(self.request.get("price"))  # Price Info of the Restaurant
        rating = int(
            self.request.get("rating"))  # Self Rating of the Restaurant
        rekitchen = self.request.get(
            "kueche")  # what for kitchen gives in the Restaurant

        lokal = Gastro(user=user.nickname(),
                       name=rename,
                       street=restreet,
                       plz=replz,
                       place=replace,
                       note=reinfo,
                       time=revisit,
                       kitchen=rekitchen,
                       rating=rating,
                       price=price)
        lokal.put()
        recoms = Recommendation.get_by_id(int(recoms_id))
        recoms.key.delete()
        return self.redirect_to("rest-list")
Ejemplo n.º 2
0
    def get(self, recoms_id):
        recoms = Recommendation.get_by_id(int(recoms_id))
        q = urllib.urlencode({
            "query":
            (recoms.name + " in " + recoms.place).encode(encoding='ascii',
                                                         errors='ignore'),
            "key":
            "AIzaSyBKdIPR1Q6TzIvjJuJzIyvybo6Mg1JLm64"
        })

        url = "https://maps.googleapis.com/maps/api/place/textsearch/json?" + q
        result = urlfetch.fetch(url)

        restaurant_info = json.loads(result.content)

        params = {"recoms": recoms, "restaurant_info": restaurant_info}
        return self.render_template("recom_details.html", params=params)
Ejemplo n.º 3
0
 def get(self, recoms_id):
     recoms = Recommendation.get_by_id(int(recoms_id))
     params = {"recoms": recoms}
     return self.render_template("recom_push.html", params=params)