- n:1의 한계 상황
- prefetch_related
- 역참조
- M:N
- dumpdata
- 1:n
- 댓글 create
- 중개모델
- delete
- migrations
- Read
- 댓글 update
- Migrate
- select_related
- ORM
- Django
- create
- 게시글
- many to many relationships
- update
- http
- 댓글 READ
- queryset api
- 쟝고
- improve query
- Article & User
- comment & user
- DB
- N:1
- ManyToManyField
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
목록Read (2)
데이터 분석 기술 블로그
1. 게시글 READ 각 게시글의 작성자 이름을 출력한다. {% for article in articles %} 작성자 : {{ article.user }} 글 번호 : {{ article.pk }} 글 제목 : {{article.title }} 글 내용: {{ article.content }} {% endfor %} 2. 게시글 UPDATE 게시글 수정 요청 사용자와 게시글 작성 사용자를 비교하여 보인의 게시글만 수정할 수 있도록 합니다. # articles/views.py @login_required def update(request, pk): article = Article.objects.get(pk=pk) if request.user == article.user: if request.method ..
1. Read 1-1 전체 게시글 조회 # articles/views.py from .models import Article def index(request): articles = Article.objects.all() context = { 'articles': articles, } return render(request, 'articles/index.html', context) Articles {% for article in articles %} 글 번호: {{ article.pk }} 글 제목: {{article.title }} 글 내용: {{article.content }} {% endfor %} 1-2. 단일 게시글 조회 # articles/urls.py urlpatterns = [ ... pat..