Django - Comment (댓글) view 구현하기
Comment (댓글) view 구현하기테스트 코드 작성 blog/tests.py # Comment를 생성한다.comment_000 = create_post(post_000, text='a test comment', author=self.author_obama) # Comment comments_div = main_div.find('div', id='comment-list') self.assertIn(comment_000.author.username, comments_div.text) self.assertIn(comment_000.text, comments_div.text) post_detail 수정하기 blog/templates/blog/post_detail.html <!-- Comment --><div id="comment-list">{% for comment in object.comment_set.all %} <div class="media mb-4"> <img class="d-flex mr-3 rounded-circle" src="http://placehold.it/50x50" alt=""> <div class="media-body"> <h5 class="mt-0">{{ comment.author }}</h5> {{ comment.get_markdwon_content | safe }} </div> </div>{% endfor %}</div> admin 사이트에서 comment확인할 수 있게 반영하기 blog/admin.py