Ejemplo n.º 1
0
 def post(self):
     key = cgi.escape(self.request.get('org'))
     # make sure the organization exists
     org = Organization.get_by_id(key)
     if org is None:
         self.invalid_input("The organization does not exist")
     else:
         self.redirect("/%s" % (key))
Ejemplo n.º 2
0
 def render_page(self):
     user = users.get_current_user()
     orgs = Organization.get_all()
     template_values = {
         'name': user.nickname(),
         'orgs': orgs,
     }
     self.run_template('admin/orgmaintenance.html', template_values)
Ejemplo n.º 3
0
 def render_page(self):
     user = users.get_current_user()
     orgs = Organization.get_all()
     print orgs[0].key
     template_values = {
         'name': user.nickname(),
         'orgs': orgs,
     }
     self.run_template('organizations.html', template_values)
Ejemplo n.º 4
0
    def get(self, org):
        lat = float(cgi.escape(self.request.get('lat')))
        lng = float(cgi.escape(self.request.get('long')))
        seats = int(cgi.escape(self.request.get('seats')))
        user = users.get_current_user()
        user_id = user.user_id()
        email = user.email()

        # try to find the record to see if it should be created or updated
        driver = Driver.get_by_id(org, user_id)
        if driver is None:
            driver = Driver(parent = Organization.organization_key(org), id = user_id)
        driver.email = email
        driver.lat = lat
        driver.lng = lng
        driver.seats = seats
        driver.put()
        
        result = {
            'success': True
        }
        result_json = json.dumps(result)
        self.response.headers['Content-Type'] = 'text/json'
        self.response.out.write(result_json)
Ejemplo n.º 5
0
 def save_org(self, key, name, city, country):
     org = Organization(id=key)
     org.name = name
     org.city = city
     org.country = country
     org.put()