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')
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)
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)
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)
def get(self, id): Comic.get_by_id(id).key.delete() return redirect(api.url_for(ComicList), 301)
def post(self, id): key = service.update_painting(id, request.get_json()) if key is not None: return redirect(api.url_for(PaintingListAdmin), 301)
def get(self, id): service.delete_painting(id) return redirect(api.url_for(PaintingListAdmin), 301)
def get(self): return redirect(api.url_for(Home))
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)
def get(self, id): service.delete_by_id(id) return redirect(api.url_for(About), 301)
def post(self): key = service.create(request.get_json()) if key is not None: return redirect(api.url_for(About), 301)