로그인을 해야 email 필드가 채워지는데 shell 창에서 로그인을 어떻게 하는지 모르겠어서 찾아봤음...
Client 클래스를 상속 받고
위 처럼 shell 창에 작성해줄 것임
def 뭐시기를 이용하는건 아니므로 self 를 빼고 작성해줄 것임.
이런식으로 작성해주고 다시 해봤는데
(이건 테스트 코드로 테스트 해볼때 이렇게 하는듯)
author_id 를 어떻게 가져와야 되는지 모르겠음
Postman 으로 위와 같이 요청보냈는데 또 에러 발생
The `.create()` method does not support writable dotted-source fields by default.
Write an explicit `.create()` method for serializer `apps.post.serializers.PostSerializer`, or set `read_only=True` on dotted-source serializer fields.
사실 postman 상에서 로그인이 되는지 먼저 구현시키고
그다음 author, title, content, thumbnail 을 채워서 요청시켜야 되는데
지금은 로그인을 먼저 구현시키지 않은상태에서 요청을 보냈음
그래서 다시 터미널창에서 시도해볼 것임
post 컬럼에 뭐가 있는지 확인해봤는데
ForeignKey로 연결한 author 의 author_id 가 있고
OneToOne로 연결한 thumbnail 의 thumbnail_id 가 생겨있는 상태더라
참고
https://cw9206.tistory.com/105
https://blog.myungseokang.dev/posts/newbie-tests-view-in-django/
https://kimdoky.github.io/django/2018/05/01/django-shell-auth/
https://nachwon.github.io/django-9-ORM/
https://buildabetterworld.tistory.com/75