def post(self): title = self.request.form.get('title') desc = self.request.form.get('desc') desc_ru = self.request.form.get('desc_ru') file = self.request.files.get('file') if not title: return self.render_response('admin_new_doc.html', **{'no_title':True}) if not file: return self.render_response('admin_new_doc.html', **{'no_file':True}) doc = Document(title=title, desc=desc, desc_ru=desc_ru, file_name=file.filename, file=db.Blob(file.read())) doc.put() return self.redirect('/admin/documents?new=1')
def get(self): documents = Document.all().order('-date').fetch(300) context = { 'documents' : documents, 'new' : self.request.args.get('new') } return self.render_response('admin_documents.html', **context)
def get(self): id = int(self.request.args.get('id')) if not id: return Response('no id given') doc = Document.get_by_id(id) if not doc: return Response('no doc found') doc.delete() return self.redirect('/admin/documents?del=1')
def get(self): ServeBasics.get(self) id = int(self.request.args.get('id')) if not id: return Response('no id') deliverable = Document.get_by_id(id) self.context['deliverable'] = deliverable if not deliverable: return Response('no deliverable found') return self.render_response('deliverable.html', **self.context)
def get(self): id = int(self.request.args.get('id')) if not id: return Response('no id') doc = Document.get_by_id(id) if not doc: return Response('no doc found') r = Response(doc.file) r.headers['Content-Type'] = 'binary/octet-stream' r.headers['Content-Disposition'] = 'attachment; filename=%s;' % doc.file_name return r
def get(self): ServeBasics.get(self) documents = Document.all().order('-date').fetch(300) self.context['documents'] = documents return self.render_response('deliverables.html', **self.context)