You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
尝试了几种方法,本想使用offset偏移掉第一个,但是发现会报这个错误: Query.order_by() being called on a Query which already has LIMIT or OFFSET applied , 根据提示发现需要使用from_self pagination = user.following.offset(1).from_self().paginate(1,20),
更合理还是使用filter,可以通过filter过滤自己后再分页 ,比如 pagination = user.following.filter(Follow.followed_id != user.id).paginate(page=page, per_page=per_page) ,
最后{% if follows|length != 0 %} 就可以了
albumy/albumy/templates/user/followers.html
Line 11 in 943829b
程序设置每页展示20用户,当关注数为21时第2页的follows|length为1,却被这个if给过滤掉了。
还有用户初始化时会首先关注自己,当获取第一页关注用户时
albumy/albumy/blueprints/user.py
Line 85 in 943829b
albumy/albumy/templates/user/followers.html
Line 13 in 943829b
The text was updated successfully, but these errors were encountered: