작정하고 장고 _ 5/11

seoyeon·2023년 5월 12일
0

UDR

목록 보기
29/42

24강_DetailView를 이용한 개인 페이지 구현

C - Read View(Detail View) - U - D

{% extends 'base.html' %}

{% block content %}

  <div>
    <div style="text-align: center; max-width: 500px; margin: 4rem auto">
      <p>
        {{ user.date_joined }} # 밑에서 수정 필요 (해당 페이지의 유저 정보 보여주도록)
      </p>
      <h2>
        {{ user.username }}
      </h2>
    </div>
  </div>

{% endblock %}

몇 번 유저 객체에 접근할 것인지 지정해줘야 함 - <int:pk>

path('detail/<int:pk>', AccountDetailView.as_view(), name='detail'),

hello_world 에서 login 클릭시 링크 연결 안됌

class AccountDetailView(DetailView):
    model = User
    context_object_name = 'target_user' # 내용 추가
    template_name = 'accountapp/detail.html'
profile
안녕하세용

0개의 댓글

관련 채용 정보