<Python> Django 프로젝트2.

Sinjae Lee·2021년 5월 30일
0

user application
avatar class - 프로필 이미지 등

ImageField 를 쓰려고 했는데 makemigrations 하니 Pip install Pillow 하라고 알려준다


가상환경에서 작업중이니 pipenv install Pillow 해주자

Ta-da! 요렇게 image 추가가 가능한 Avatar 와 Gender 가 추가되었다

위의 field 에서 Charfield 와 Textfield 보면 char는 single line text 이며 글자 수 제한이 있다. 반면 Textfield는 제한이 없다

Gender 에 option 을 부여해주자

요렇게 버튼이 생겨버렸다

원래는 없던 Gender나 Avatar 를 새로 만들었을때 는 migration 해줘야 하지만 이렇게 Django의 database 에 직접 영향을 준게 아닌 form 만 변경해준 경우에는 migrate 할 필요 없다

똑같이 lang birthdate, currency, superhost 항목을 추가해줬다 birthdate 는 DateField, superhost는 BooleanField 를 적용해줬다

profile
Back-end developer

0개의 댓글