manage.py있는 위치에서
python manage.py startapp posting
posting이라는 앱을 생성했다.
한마디로 정리하면 auto_now는 수정일자, auto_now_add는 생성일자
post
메소드를 사용했다. get
메소드를 사용했다. postings
라는 변수에 Posting에 있는 모든 객체를 넣어줬다.content_list
라는 빈 리스트를 만들었다.posting
for문을 돌렸다.content_list
에 contents
를 넣어주고 return을 시켜주었다. -westagram/urls.py
-posting/urls.py
만약 게시물을 올리고싶으면 이렇게 경로를 타고 들어가면 된다.
http POST localhost:8000/posting/contentsignup name='hyeyoon12' image_url='http://image.dongascience.com/Photo/2020/03/5bddba7b6574b95d37b6079c199d7101.jpg' description='화난갱얼쥐'
DB에도 잘 들어갔다ㅎㅎ
잘 보고 가요~ 화이팅 화이탱~!