diff --git a/web/app.py b/web/app.py index ff0b615..198cd6c 100644 --- a/web/app.py +++ b/web/app.py @@ -2533,6 +2533,63 @@ TG #: ''' + str(tg_d.tg) + ''' return render_template('tg_all.html', markup_content = Markup(content)) + @app.route('/tags', methods=['POST', 'GET']) +## @login_required + def tag_list(): + content = '' + if request.args.get('tag'): + ss_tags = Social.query.filter(Social.message.ilike('%#' + request.args.get('tag') + '%')).order_by(Social.time.desc()).all() + bb_tags = BulletinBoard.query.filter(BulletinBoard.bulletin.ilike('%#' + request.args.get('tag') + '%')).order_by(BulletinBoard.time.desc()).all() + sms_tags = SMSLog.query.filter(SMSLog.message.ilike('%#' + request.args.get('tag') + '%')).order_by(SMSLog.time.desc()).all() + for i in ss_tags: + tag = re.sub('.*#| .*', '', i.message) + content = content + ''' + ''' + i.message + ''' | ''' + str((i.time + timedelta(hours=hbnet_tz)).strftime(time_format)) + ''' + ''' + for i in bb_tags: + tag = re.sub('.*#| .*', '', i.bulletin) + content = content + ''' + ''' + i.bulletin + ''' | ''' + str((i.time + timedelta(hours=hbnet_tz)).strftime(time_format)) + ''' + ''' + for i in sms_tags: + tag = re.sub('.*#| .*', '', i.message) + content = content + ''' + ''' + i.message + ''' | ''' + str((i.time + timedelta(hours=hbnet_tz)).strftime(time_format)) + ''' + ''' + + + else: + ss_tags = Social.query.filter(Social.message.ilike('%#%')).order_by(Social.time.desc()).all() + bb_tags = BulletinBoard.query.filter(BulletinBoard.bulletin.ilike('%#%')).order_by(BulletinBoard.time.desc()).all() + sms_tags = SMSLog.query.filter(SMSLog.message.ilike('%#%')).order_by(SMSLog.time.desc()).all() + + rend_list = [] + for i in ss_tags: + tag = re.sub('.*#| .*', '', i.message) + if tag not in rend_list: + content = content + ''' + #''' + tag + ''' + ''' + rend_list.append(str(tag)) + for i in bb_tags: + tag = re.sub('.*#| .*', '', i.bulletin) + if tag not in rend_list: + content = content + ''' + #''' + tag + ''' + ''' + rend_list.append(str(tag)) + + for i in sms_tags: + tag = re.sub('.*#| .*', '', i.message) + if tag not in rend_list: + content = content + ''' + #''' + tag + ''' + ''' + rend_list.append(str(tag)) + + return render_template('tags.html', markup_content = Markup(content)) + + @app.route('/sms.xml') def rss_sms(): rss_header = """ diff --git a/web/templates/tags.html b/web/templates/tags.html new file mode 100644 index 0000000..c170543 --- /dev/null +++ b/web/templates/tags.html @@ -0,0 +1,25 @@ +{% extends 'flask_user/_public_base.html' %} +{% block content %} + +

#Tags

+ +
+ + + + + + + + + + {{markup_content}} + + +
Tag
+ + + +
+ +{% endblock %}