Skip to content

Commit

Permalink
feat(diary): make comments ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Hojagulyyev committed Dec 26, 2023
1 parent e54d888 commit a1c04c8
Show file tree
Hide file tree
Showing 6 changed files with 397 additions and 107 deletions.
7 changes: 5 additions & 2 deletions apps/diaries/interactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def create_comment(request, diary_id: int):
)
.exists()
):
messages.error(request, message="this message already exists for today")
messages.error(request, message="this comment already exists for today")
return redirect(
f"{reverse(viewname='diaries:detail_view', kwargs={'id': diary.id})}"
f"?body={body}"
Expand All @@ -97,4 +97,7 @@ def create_comment(request, diary_id: int):
diary.comments_last_read_by = request.user.account
diary.save(update_fields=["comments_last_read_by"])

return redirect("diaries:detail_view", diary.id)
return redirect(
f"{reverse(viewname='diaries:detail_view', kwargs={'id': diary.id})}"
f"?on_comments_tab=1"
)
1 change: 1 addition & 0 deletions apps/diaries/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@

urlpatterns += [
path('<int:diary_id>/commit/', interactors.create_commit, name="commit"),
path('<int:diary_id>/comment/', interactors.create_comment, name="comment"),
# path('<int:id>/update/', interactors.update, name="update"),
]
Loading

0 comments on commit a1c04c8

Please sign in to comment.