def group_admin(): wiki_page_num = WikiPage.select().count() wiki_file_num = WikiFile.select().count() return render_template( 'wiki/group_admin.html', wiki_page_num=wiki_page_num, wiki_file_num=wiki_file_num )
def all_files(): current_page_number = request.args.get('page', default=1, type=int) number_per_page = 100 query = (WikiFile.select().order_by(WikiFile.id).paginate( current_page_number, paginate_by=number_per_page)) kwargs = dict() get_pagination_kwargs(kwargs, query, current_page_number, number_per_page) return render_template('wiki/all_files.html', **kwargs)
def file(wiki_file_id): fn = request.args.get('filename') if not fn: wiki_file = get_object_or_404( WikiFile.select(WikiFile.id, WikiFile.name), WikiFile.id == wiki_file_id) fn = wiki_file.name return send_from_directory(os.path.join(DB_PATH, g.wiki_group), str(wiki_file_id), as_attachment=True, attachment_filename=fn)
def file(wiki_file_id): wiki_file = get_object_or_404( WikiFile.select(WikiFile.id, WikiFile.name), WikiFile.id==wiki_file_id ) return send_from_directory( os.path.join(current_app.config['DB_PATH'], g.wiki_group), str(wiki_file_id), as_attachment=True, attachment_filename=wiki_file.name )