예제 #1
0
  def _post(self):
    name = self.request.get("name")
    spouse = self.request.get("spouse")
    family = self.request.get("family")
    email = self.request.get("email").lower()
    veg = int(self.request.get("veg", 0))
    nonveg = int(self.request.get("nonveg", 0))
    total_veg_cost = veg * veg_cost
    total_non_veg_cost = nonveg * non_veg_cost
    total = total_veg_cost + total_non_veg_cost

    form_values = {
      'id': email,
      'name':name,
      'spouse': spouse,
      'family': family,
      'email': email,
      'veg': veg,
      'nonveg': nonveg,
      'total_veg_cost': total_veg_cost,
      'total_non_veg_cost': total_non_veg_cost,
      'total': total,
    }
    person_query = PersonEntityClass.query(PersonEntityClass.email==email)

    if person_query.count() and person_query.fetch()[0].paid:
      self.redirect('/thanks/%s' % email)
    else:
      person_entity = PersonEntityClass(**form_values)
      person_entity.put()
      self.redirect('/pay/%s' % email)
예제 #2
0
 def get(self, email):
   if email:
     person_query = PersonEntityClass.query(PersonEntityClass.email==email)
     if person_query.count():
       person = person_query.fetch()[0]
       values = {
         'name': person.name,
         'spouse': person.spouse,
         'family': person.family,
         'veg': person.veg,
         'total_veg_cost': person.total_veg_cost,
         'nonveg': person.nonveg,
         'total_non_veg_cost': person.total_non_veg_cost,
         'total_food_cost': person.total,
         'email': person.email
       }
       self.response.write(pay_template.render(values))
       if not person.email_sent:
         person.email_sent = True
         person.put()
         send_email(**values)
     else:
       self.response.write(cancel_template.render())
   else:
     self.redirect('/')
예제 #3
0
 def get(self, email):
   if email:
     person_query = PersonEntityClass.query(PersonEntityClass.email==email)
     if person_query.count():
       person = person_query.fetch()[0]
       person.paid = True
       person.put()
       self.response.write(thankyou_template.render())
     else:
       self.response.write(cancel_template.render())
   else:
     self.response.write(thankyou_template.render())
예제 #4
0
  def get(self):
    person_query = PersonEntityClass.query().fetch()
    values = {
      'allrecords': person_query,
      'total_registered': len(person_query),
      'total_veg' : sum([p.veg for p in person_query]),
      'total_nonveg' : sum([p.nonveg for p in person_query]),
      'total_payment': sum([p.total for p in person_query]),
      'total_received': sum([p.total for p in person_query if p.paid])
    }

    self.response.write(list_template.render(values))