Add statistics with object counts to admin page.
This commit is contained in:
parent
ca2a4ec365
commit
bdce60fce6
2 changed files with 17 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
import flask; from flask import request
|
import flask; from flask import request
|
||||||
|
|
||||||
|
from voussoirkit import dotdict
|
||||||
from voussoirkit import flasktools
|
from voussoirkit import flasktools
|
||||||
from voussoirkit import timetools
|
from voussoirkit import timetools
|
||||||
|
|
||||||
|
@ -17,7 +18,14 @@ def get_admin():
|
||||||
if not request.is_localhost:
|
if not request.is_localhost:
|
||||||
flask.abort(403)
|
flask.abort(403)
|
||||||
|
|
||||||
return common.render_template(request, 'admin.html')
|
counts = dotdict.DotDict({
|
||||||
|
'albums': common.P.get_album_count(),
|
||||||
|
'bookmarks': common.P.get_bookmark_count(),
|
||||||
|
'photos': common.P.get_photo_count(),
|
||||||
|
'tags': common.P.get_tag_count(),
|
||||||
|
'users': common.P.get_user_count(),
|
||||||
|
})
|
||||||
|
return common.render_template(request, 'admin.html', counts=counts)
|
||||||
|
|
||||||
@site.route('/admin/dbdownload')
|
@site.route('/admin/dbdownload')
|
||||||
def get_dbdump():
|
def get_dbdump():
|
||||||
|
|
|
@ -28,6 +28,14 @@
|
||||||
<p><button id="clear_sessions_button" class="green_button" onclick="return clear_sessions_form();">Clear login sessions</button></p>
|
<p><button id="clear_sessions_button" class="green_button" onclick="return clear_sessions_form();">Clear login sessions</button></p>
|
||||||
<p><a href="/admin/dbdownload">Download database file</a></p>
|
<p><a href="/admin/dbdownload">Download database file</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Statistics</h2>
|
||||||
|
<p>{{counts.albums}} albums</p>
|
||||||
|
<p>{{counts.bookmarks}} bookmarks</p>
|
||||||
|
<p>{{counts.photos}} photos</p>
|
||||||
|
<p>{{counts.tags}} tags</p>
|
||||||
|
<p>{{counts.users}} users</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue