Skip to content

Instantly share code, notes, and snippets.

@kergalym
Created January 26, 2017 16:51
Show Gist options
  • Save kergalym/5d823b64ace1d5f0f26f567c620796ab to your computer and use it in GitHub Desktop.
Save kergalym/5d823b64ace1d5f0f26f567c620796ab to your computer and use it in GitHub Desktop.
@app.route('/adminboard/adminboard_main/')
@login_required
def show_dashboard_main():
per_page = 9
articles_loop = []
form = dashboard_itemsform.DashboardItemsForm()
servername = socket.gethostname()
approot = app.root_path
users = g.user
instance = SysInfo()
freespace = instance.diskspace()
ltime = instance.systime()
atime = instance.altertime()
pages = request.args.get('page', type=int, default=1)
if not users and pages == None:
abort(404)
else:
totalrecords = len(Articles.query.all())
articles_loop = Articles.query.limit(
(per_page)).offset(
(pages - 1) * per_page).all()
pagination = Pagination(page=pages, total=totalrecords,
per_page=per_page, css_framework='bootstrap')
return render_template('adminboard/adminboard_main.html',
servername=servername,
approot=approot,
freespace=freespace,
users=users, ltime=ltime,
atime=atime,
articles_loop=articles_loop,
form=form,
pagination=pagination
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment