Exemplo n.º 1
0
 def post(self):
     user_key = self.check_user_logged_in.key
     title = self.request.get('title').encode("utf-8")
     quantity = int(self.request.get('quantity').encode("utf-8"))
     city = self.request.get('city').encode("utf-8")
     country = self.request.get('country').encode()
     state = self.request.get('state').encode()
     comments = self.request.get('comments').encode()
     photo = self.request.POST['image']
     saved_photo = self.save_image(photo, user_key)
     print(user_key, title, quantity, city, country)
     Donations.add_new_donation(
         title=title,
         quantity=quantity,
         city=city,
         country=country,
         state=state,
         comments=comments,
         photo_key=saved_photo['blobstore_key'],
         photo_url=saved_photo['serving_url'],
         user_key=user_key,
     )
     self.redirect('/account')
Exemplo n.º 2
0
 def post(self):
     user_key = self.check_user_logged_in.key
     title = self.request.get("title").encode("utf-8")
     quantity = int(self.request.get("quantity").encode("utf-8"))
     city = self.request.get("city").encode("utf-8")
     country = self.request.get("country").encode()
     state = self.request.get("state").encode()
     comments = self.request.get("comments").encode()
     photo = self.request.POST["image"]
     saved_photo = self.save_image(photo, user_key)
     print (user_key, title, quantity, city, country)
     Donations.add_new_donation(
         title=title,
         quantity=quantity,
         city=city,
         country=country,
         state=state,
         comments=comments,
         photo_key=saved_photo["blobstore_key"],
         photo_url=saved_photo["serving_url"],
         user_key=user_key,
     )
     self.redirect("/account")
Exemplo n.º 3
0
 def get(self):
     user_id = self.check_user_logged_in.key.id()
     print user_id
     donations = Donations.get_all_donations_user(user_id)
     tpl_values = {'donation': donations}
     self.render('/account/account_home.html', **tpl_values)
Exemplo n.º 4
0
 def get(self):
     user_id = self.check_user_logged_in.key.id()
     print user_id
     donations = Donations.get_all_donations_user(user_id)
     tpl_values = {"donation": donations}
     self.render("/account/account_home.html", **tpl_values)
Exemplo n.º 5
0
 def get(self, donation_id):
     donation = Donations.get_by_id(int(donation_id))
     template_value = {'donation': donation}
     self.render('donation-page/donation-page.html', **template_value)