Exemplo n.º 1
0
	def post(self):
		new_jersey = Jersey()
		new_jersey.name = self.request.get('name')
		
		try:
			new_jersey.front_img = self.request.get('front_img')
		except:
			new_jersey.front_img = None

		try:
			new_jersey.back_img = self.request.get('back_img')
		except:
			new_jersey.back_img = None

		new_jersey.put()
		self.response.status_int = 201
		self.response.headers['Content-Type'] = 'application/json'
		self.response.write(json.encode(new_jersey.to_dict()))
Exemplo n.º 2
0
	def get(self):
		jerseys = Jersey.query().fetch(20)
		self.response.headers['Content-Type'] = 'application/json'
		self.response.write(json.encode([j.to_dict() for j in jerseys]))