- 스택
- 이진트리
- update
- outer join
- SQL
- regexp
- N:1
- DB
- drf
- 완전검색
- 큐
- 뷰
- stack
- 쟝고
- 통계학
- Django
- create
- migrations
- Tree
- Article & User
- Queue
- 그리디
- Vue
- 트리
- distinct
- count
- delete
- ORM
- 백트래킹
- M:N
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
목록댓글 READ (2)
데이터 분석 기술 블로그

1. 댓글 CREATE댓글 작성 시 이전에 게시글 작성할 때와 동일한 에러가 발생합니다. 댓글의 user_id 필드 데이터가 누락되었기 때문입니다.댓글 작성 시 작성자 정보가 함께 저장할 수 있도록 작성합니다.# articles/views.pydef comments_create(request, pk): article = Article.objects.get(pk=pk) comment_form = CommentForm(request.POST) if comment_form.is_valid(): comment = comment_form.save(commit=False) comment.article = article comment.user = request.u..

1. 댓글 READ 구현 detail view 함수에서 전체 댓글 데이터를 조회 # articles/views.py from .models import Article, Comment def detail(request, pk): article = Article.objects.get(pk=pk) comment_form = CommentForm() comments = article.comment_set.all() context = { 'article': article, 'comment_form': comment_form, 'comments': comments, } return render(request, 'articles/detail.html', context) 댓글 목록 {% for comment in co..