Skip to content

Commit

Permalink
style: lint views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Topology2333 committed Nov 10, 2023
1 parent 38180a7 commit 858c082
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hinghwa-dict-backend/article/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ def get(self, request, id) -> JsonResponse:
):
raise ArticleNotFoundException()
article = article[0]
comments = [comment_normal(comment)
for comment in article.comments.all()]
comments = [comment_normal(comment) for comment in article.comments.all()]
return JsonResponse({"comments": comments}, status=200)

# AT0401 发表文章评论
Expand Down Expand Up @@ -314,7 +313,7 @@ def get(self, request, id) -> JsonResponse: # 注意没有使用request,位
# 这里为什么不是 except Comment.DoesNotExist
except:
raise CommentNotFoundException(id)

# 登录获取 user 信息
try:
token = token_pass(request.headers)
Expand All @@ -323,7 +322,7 @@ def get(self, request, id) -> JsonResponse: # 注意没有使用request,位
return JsonResponse({"comment": comment_all(comment), "me": me}, status=401)

is_liked = comment.like_users.filter(id=user.id).exists()
is_author = (user == comment.user if user else False)
is_author = user == comment.user if user else False

me = {"is_liked": is_liked, "is_author": is_author}

Expand Down

0 comments on commit 858c082

Please sign in to comment.