Esempio n. 1
0
    def get(self):
        path = os.path.join(os.path.dirname(__file__), 'templates', 'admin_campers.html')
        conf = camp.current()
        campers = db.GqlQuery('SELECT * FROM Camper')
        registered_campers = []
        accepted_campers = []
        waitlisted_campers = []
        rejected_campers = []
	withdrew_campers = []
        for camper in campers:
            logging.error(camper.status)
            if camper.status == 'registered':
                registered_campers.append(camper)
            if camper.status == 'accepted':
                accepted_campers.append(camper)
            if camper.status == 'rejected':
                rejected_campers.append(camper)
            if camper.status == 'waitlisted':
                waitlisted_campers.append(camper)            
            if camper.status == 'withdrew':
                withdrew_campers.append(camper)

        self.response.out.write(template.render(path, {'conf' : conf, 
                                                       'registered_campers' : registered_campers,
                                                       'accepted_campers' : accepted_campers,
                                                       'rejected_campers' : rejected_campers,
                                                       'waitlisted_campers' : waitlisted_campers,
						       'withdrew_campers' : withdrew_campers
                                                       }))
Esempio n. 2
0
 def get(self):
     path_lst = self.request.path.split('/')
     path_lst.reverse()
     path_lst.append('templates')
     path_lst.append(os.path.dirname(__file__))
     path_lst.reverse()
     path = os.sep.join(path_lst)
     conf = camp.current()
     self.response.out.write(template.render(path, { 'camp' : conf }))
Esempio n. 3
0
    def get(self):
        path = os.path.join(os.path.dirname(__file__), 'templates', 'edit_camper.html')
        conf = camp.current()
	camper = db.get(self.request.get('camper_key'))
	dates = campdate.SortedDates()
	healer = None
 	for h in camper.healer_set:
  	  healer = h	
        self.response.out.write(template.render(path, {'conf' : conf, 'camper' : camper, 'healer' : healer, 'dates' : dates}))
Esempio n. 4
0
 def get(self):
     conf = camp.current()
     camper = db.get(self.request.cookies['_camper_key'])
     camper.status = 'registered'
     camper.put()
     path = os.path.join(os.path.dirname(__file__), 'templates', 'reg_confirm.html')
     self.response.out.write(template.render(path, { 'camper' : camper, 'camp' : conf }))
     mail.send_mail(sender=conf.reg_email_from,
                    to=camper.email,
                    subject=conf.reg_email_subject,
                    body=conf.reg_email_body)
Esempio n. 5
0
 def get(self):
     conf = camp.current()
     if conf.reg_open:
         c = camper.Camper()
         c.put()
         self.response.headers.add_header('Set-Cookie', '_camper_key=%s' % (c.key()))
     
         path = os.path.join(os.path.dirname(__file__), 'templates', 'reg_landing.html')
         self.response.out.write(template.render(path, {'camp' : conf }))
     else:
         path = os.path.join(os.path.dirname(__file__), 'templates', 'reg_closed.html')
         self.response.out.write(template.render(path, {'camp' : conf }))
Esempio n. 6
0
    def get(self):
        conf = camp.current()
        camper = db.get(self.request.cookies['_camper_key'])
        path = os.path.join(os.path.dirname(__file__), 'templates', 'reg_dates.html')

        early_dates = db.GqlQuery('SELECT * FROM CampDate WHERE early_team=TRUE ORDER BY date').fetch(100)
        dates = db.GqlQuery('SELECT * FROM CampDate WHERE early_team=FALSE ORDER BY date').fetch(100)
        strike_dates = db.GqlQuery('SELECT * FROM CampDate WHERE strike=TRUE ORDER BY date').fetch(100)

        self.response.out.write(template.render(path, { 'camper' : camper, 
                                                        'camp' : conf,
                                                        'early_dates' : early_dates,
                                                        'dates' : dates,
                                                        'strike_dates' : strike_dates }))
Esempio n. 7
0
 def post(self):
     conf = camp.current()
     conf.year = int(self.request.get('year'))
     conf.reg_open = self.request.get('reg_open') == 'on'
     conf.reg_closed_message = self.request.get('reg_closed_message')
     conf.reg_page_message = self.request.get('reg_page_message')
     conf.location_message = self.request.get('location_message')
     conf.base_dues = int(self.request.get('base_dues'))
     conf.early_team_discount = int(self.request.get('early_team_discount'))
     conf.strike_discount = int(self.request.get('strike_discount'))
     conf.early_pay_discount = int(self.request.get('early_pay_discount'))
     conf.reg_email_from = self.request.get('reg_email_from')
     conf.reg_email_subject = self.request.get('reg_email_subject')
     conf.reg_email_body = self.request.get('reg_email_body')
     conf.put()
     self.redirect('/admin/camp')
Esempio n. 8
0
    def get(self):
        path = os.path.join(os.path.dirname(__file__), 'templates', 'admin_committee_assignments.html')
        conf = camp.current()
        campers = db.GqlQuery('SELECT * FROM Camper WHERE status=\'accepted\'')
        unassigned_campers = []
        assigned_campers = {}
        for committee in conf.committees:
            assigned_campers[committee] = []
        for camper in campers:
            if not camper.assigned_committee:
                unassigned_campers.append(camper)
            else:
              if camper.assigned_committee in assigned_campers: 
	  	assigned_campers[camper.assigned_committee].append(camper)
	      else:
	        unassigned_campers.append(camper)

        template_vars = { 'conf' : conf,
                          'unassigned_campers' : unassigned_campers,
                          'assigned_campers' : assigned_campers}
#        for (committee, campers) in assigned_campers.items();
#          template_vars[committee] = campers
        self.response.out.write(template.render(path, template_vars))
Esempio n. 9
0
 def post(self):
     conf = camp.current()
     camper = db.get(self.request.get('key'))
     camper.assigned_committee = self.request.get('assigned_committee')
     camper.put()        
     self.redirect('/admin/committeeassigner')
Esempio n. 10
0
 def post(self):
     conf = camp.current()
     conf.committees.remove(self.request.get('committee'))
     conf.put()        
     self.redirect('/admin/camp')
Esempio n. 11
0
 def post(self):
     conf = camp.current()
     camper = db.get(self.request.get('key'))
     camper.status = self.request.get('status')
     camper.put()        
     self.redirect('/admin/campers')
Esempio n. 12
0
 def get(self):
     path = os.path.join(os.path.dirname(__file__), 'templates', 'admin_camp.html')
     conf = camp.current()
     dates = db.GqlQuery('SELECT * FROM CampDate ORDER BY date')
     self.response.out.write(template.render(path, {'conf' : conf, 'dates' : dates}))
Esempio n. 13
0
    def get(self):
	conf = camp.current()
	empty_meal = { 'meal' : 'who knows?',
		       'omnivore' : 0,
                       'pescatarian' : 0,
	  	       'vegitarian' : 0,
		       'vegan' : 0,
                       'raw' : 0,
                       'beef' : 0,
                       'chicken' : 0,
                       'pork' : 0,
                       'bacon' : 0,
                       'fish' : 0,
                       'tofu' : 0,
                       'total' : 0 }
        meal_counts = []
        campers = []
	q = db.GqlQuery('SELECT * FROM Camper WHERE status = \'accepted\'')
        for c in q.fetch(100):
          campers.append(c)
	for cd in campdate.SortedDates():
	  breakfast = empty_meal.copy()
	  lunch = empty_meal.copy()
	  dinner = empty_meal.copy()
	  breakfast['restrictions'] = []
	  lunch['restrictions'] = []
	  dinner['restrictions'] = []
	  breakfast['date'] = str(cd.date)
	  lunch['date'] = str(cd.date)
	  dinner['date'] = str(cd.date)
	  breakfast['meal'] = 'breakfast'
	  lunch['meal'] = 'lunch'
	  dinner['meal'] = 'dinner'
	  for c in campers:
            if c.arrival_date < str(cd.date) and c.departure_date > str(cd.date):
              self.add_to_meal(breakfast, c)
              self.add_to_meal(lunch, c)
              self.add_to_meal(dinner, c)
	      logging.info(str(breakfast))
            if c.arrival_date == str(cd.date):
              if c.arrival_time == 'before_breakfast':
	        self.add_to_meal(breakfast, c)
   		self.add_to_meal(lunch, c)
	 	self.add_to_meal(dinner, c)
	      if c.arrival_time == 'before_lunch':
	        self.add_to_meal(lunch, c)
	        self.add_to_meal(dinner, c)
	      if c.arrival_time == 'before_dinner':
	        self.add_to_meal(dinner, c)
            if c.departure_date == str(cd.date):
	      if c.departure_time == 'after_dinner':
	        self.add_to_meal(breakfast, c)
	        self.add_to_meal(lunch, c)
	        self.add_to_meal(dinner, c)
              if c.departure_time == 'before_dinner':
                self.add_to_meal(breakfast, c)
                self.add_to_meal(lunch, c)
              if c.departure_time == 'before_lunch':
                self.add_to_meal(breakfast, c)
          meal_counts.append(breakfast)
	  meal_counts.append(lunch)
          meal_counts.append(dinner)

        path = os.path.join(os.path.dirname(__file__), 'templates', 'meals_data.csv')
        self.response.out.write(template.render(path, { 'meal_counts': meal_counts }))
Esempio n. 14
0
 def get(self):
     path = os.path.join(os.path.dirname(__file__), 'templates', 'index.html')        
     conf = camp.current()
     self.response.out.write(template.render(path, { 'camp' : conf }))
Esempio n. 15
0
 def get(self):
     conf = camp.current()
     camper = db.get(self.request.cookies['_camper_key'])
     
     path = os.path.join(os.path.dirname(__file__), 'templates', 'reg_playainfo.html')
     self.response.out.write(template.render(path, { 'camper' : camper, 'camp' : conf }))