diff --git a/app/main.py b/app/main.py index 2af57e3..e134da2 100644 --- a/app/main.py +++ b/app/main.py @@ -11,7 +11,7 @@ from Article import * import Yaml from user_service import userService from account_service import accountService -from admin_service import adminService +from admin_service import adminService, ADMIN_NAME app = Flask(__name__) app.secret_key = 'lunch.time!' @@ -98,8 +98,13 @@ def mainpage(): d = load_freq_history(path_prefix + 'static/frequency/frequency.p') d_len = len(d) lst = sort_in_descending_order(pickle_idea.dict2lst(d)) - return render_template('mainpage_get.html', random_ads=random_ads, number_of_essays=number_of_essays, - d_len=d_len, lst=lst, yml=Yaml.yml) + return render_template('mainpage_get.html', + admin_name=ADMIN_NAME, + random_ads=random_ads, + d_len=d_len, + lst=lst, + yml=Yaml.yml, + number_of_essays=number_of_essays) if __name__ == '__main__': diff --git a/app/templates/mainpage_get.html b/app/templates/mainpage_get.html index 4cc4417..15da6c4 100644 --- a/app/templates/mainpage_get.html +++ b/app/templates/mainpage_get.html @@ -23,12 +23,15 @@
English Pal - Learn English smartly!
{% if session['logged_in'] %} - {{session['username']}} 管理 + {{ session['username'] }} + {% if session['username'] == admin_name %} + 管理 + {% endif %} {% else %}{{random_ads|safe}}
{% endif %} -粘贴1篇文章 (English only)