예제 #1
0
	def post(self):
		try:
			f = request.files['file']
			header = f.headers['Content-Type']
			parsed_header = parse_options_header(header)
			blob_key = parsed_header[1]['blob-key']
			service.create_painting(request.get_json(), blob_key)

			return redirect(api.url_for(PaintingListAdmin), 301)

		except():
			return self.redirect('/admin/paintings/failure')
예제 #2
0
파일: track.py 프로젝트: stretchhog/prfit
	def post(self, category_key):
		form = self.get_form(category_key)
		if form.validate_on_submit():
			for changed in set(form.activities.default).symmetric_difference(set(form.activities.data)):
				activity = Key(urlsafe=changed).get()
				if changed in form.activities.data:
					activity.tracked = True
				else:
					activity.tracked = False
				activity.put()
			flash('Update successful', category='success')
			return redirect(api.url_for(Activities, category_key=category_key))
		flash('Update not successful', category='warning')
		return self.response('track/track_activity.html', form, category_key)
예제 #3
0
파일: records.py 프로젝트: stretchhog/prfit
	def post(self, activity_key):
		activity = Key(urlsafe=activity_key).get()
		form = select_form(activity)().new(activity)
		if form.validate_on_submit():
			if activity.category_key.get().name == 'Crossfit':
				entity = CrossfitRecord()
			else:
				entity = BaseRecord()
			form.populate_obj(entity)
			entity.user_key = auth.current_user_key()
			if entity.is_valid_entry(form):
				entity.put()
				flash('Toevoegen succesvol.', category='success')
				return redirect(api.url_for(Activities, category_key=activity.category_key.urlsafe()))
		flash('Toevoegen niet gelukt.', category='warning')
		return base_auth_response('records/new_record.html', activity=activity, form=form)
예제 #4
0
    def post(self):
        form = ComicCreateForm(data=request.get_json())
        if form.validate():
            pass
        else:
            abort(400)
        qry = Comic.query(Comic.number == form.number.data)
        if len(qry.fetch(1)) > 0:
            return make_response(render_template("409.html"))

        comic = Comic()
        comic.number = form.number.data
        comic.title = crawler.findTitle(comic.number)
        image = crawler.findImage(comic.number)
        comic.image = b64encode(image) if image is not None else image
        comic.put()
        return redirect(api.url_for(ComicList), 301)
예제 #5
0
    def post(self):
        form = ComicCreateForm(data=request.get_json())
        if form.validate():
            pass
        else:
            abort(400)
        qry = Comic.query(Comic.number == form.number.data)
        if len(qry.fetch(1)) > 0:
            return make_response(render_template("409.html"))

        comic = Comic()
        comic.number = form.number.data
        comic.title = crawler.findTitle(comic.number)
        image = crawler.findImage(comic.number)
        comic.image = b64encode(image) if image is not None else image
        comic.put()
        return redirect(api.url_for(ComicList), 301)
예제 #6
0
 def get(self, id):
     Comic.get_by_id(id).key.delete()
     return redirect(api.url_for(ComicList), 301)
예제 #7
0
	def post(self, id):
		key = service.update_painting(id, request.get_json())
		if key is not None:
			return redirect(api.url_for(PaintingListAdmin), 301)
예제 #8
0
	def get(self, id):
		service.delete_painting(id)
		return redirect(api.url_for(PaintingListAdmin), 301)
예제 #9
0
 def get(self):
     return redirect(api.url_for(Home))
예제 #10
0
 def get(self, id):
     Comic.get_by_id(id).key.delete()
     return redirect(api.url_for(ComicList), 301)
예제 #11
0
	def post(self, id):
		key = service.update_by_id(id, request.get_json())
		if key is not None:
			return redirect(api.url_for(About), 301)
예제 #12
0
	def get(self, id):
		service.delete_by_id(id)
		return redirect(api.url_for(About), 301)
예제 #13
0
	def post(self):
		key = service.create(request.get_json())
		if key is not None:
			return redirect(api.url_for(About), 301)