Profile

User profile and story timeline

user-img
nyg

flask 网站 关键词搜索遗留问题:1、不能进行多个关键词搜索。2、不能删除动态。3、发送多个邮件及附件。4、动态不能按日期排布,不方便检索和归类。5、文章不能直接修改,需要删掉原文。6、网站编辑器使用CKEditor 5,好像需要收费,但功能却是不错。更新编辑器时,可能存在缓存问题,需要重启电脑才能生效;通过终端运行查看编辑器显示不正常的原因。7、修改了检索日期由近到远排列。
1、已解决。views.py- L210
from sqlalchemy import desc,asc
def search1():
content = request.args.get('s1',default="flask")
arr = content.split()

if len(arr)  == 1:
    postarts = Post.query.filter(Post.body.like("%"+arr[0]+"%") if content is not None else "").order_by(desc("timestamp")).all()
    return render_template('test-profile1.html',postarts =postarts)
elif len(arr) == 2:
    postarts = Post.query.filter(Post.body.like("%"+arr[0]+"%") if content is not None else "",Post.body.like("%"+arr[1]+"%")).order_by(desc("timestamp")).all()
    return render_template('test-profile1.html',postarts =postarts)
else:
    postarts = Post.query.filter(Post.body.like("%"+arr[0]+"%") if content is not None else "",Post.body.like("%"+arr[1]+"%"),Post.body.like("%"+arr[2]+"%")).order_by(desc("timestamp")).all()
    return render_template('test-profile1.html',postarts =postarts)

回复