def put(self, company_id): company = Company.get_by_id(int(company_id)) name = self.request.get('name') if Company.query(Company.name == name).count() > 0: response = {'success': False, 'error_message': "A company already exists with the name {0}".format(name)} self.response.write(json.dumps(response)) return company.edit_company(name=name) response = {'success': True, 'goto_url': '/account/company/{0}'.format(company.key.id())} self.response.write(json.dumps(response))
def post(self): company_id = int(self.request.get('company-id')) location_kwargs = { 'company': Company.get_by_id(company_id), 'name': self.request.get('name'), 'country': self.request.get('country'), 'state': self.request.get('state'), 'city': self.request.get('city'), 'location_type': self.request.get('location-type'), 'adult_ads_restricted': bool(int(self.request.get('adult-ads-restricted'))), 'adult_oriented': bool(int(self.request.get('adult-oriented'))) } new_location = Location.create_location(**location_kwargs)
def get(self, company_id): company = Company.get_by_id(int(company_id)) self.template_values['company'] = company self.render_template('account/company/caucus_new_edit.html')
def get(self, company_id): company = Company.get_by_id(int(company_id)) self.response.write(company.name)