django2 5일차

박예원·2023년 9월 2일
0

30. Profileapp 시작 그리고 ModelForm

Profileapp

  1. profileapp 설치(python manage.py startapp profileapp)
  2. settings.py INSTALLED_APPS에 profileapp 기입
  3. urls.py에서 profileapp 경로 추가
  4. profileapp에서 urls.py 만들기
  5. profileapp의 models.py에서 class Profile추가

ModelForm

  1. profileapp에서 forms.py 만들기


31. Profileapp 구현 시작

  1. migrations 파일 만들기
  2. profileapp의 view.py에서 class ProfileCreateView 만들기
  3. profileapp/templates/profileapp만들고 안에 accountapp/create.html 복붙하기(이미지 넣으려면 enctype="multipart/form-data" 필수)
  4. profileapp의 urls.py에서 profileapp 경로 추가
  5. accountapp/detail.html에서 MyPage에서 nickname 보일 수 있도록 수정
  6. views.py에 def form_valid 추가


32. Profileapp 마무리

edit
1. profileapp/views.py에서 class ProfileUpdateView 추가
2. profileapp/urls.py에서 ProfileUpdateView 경로 추가
3. profuleapp/templates/profileapp에 update.html 만들기
4. accoutapp/detail.html에 edit 추가

사진나오게, 마무리
1. yewon/urls.py에 static(url에서 가져오기) 추가
2. detail.html 수정
3. profileapp에 decorators.py 만들기
4. views.py에 @method_decorator 추가

멍청실수

  1. +를 *로 써서 한참헤메다
  2. 등등 많음
profile
안녕하세요.

0개의 댓글