I have been following Sanjeev’s course from sometime when creating the post using the below path operation has shownby Sanjeev in the course:
@app.post(“/posts”)
def create_posts(post: Post):
post_dict=post.dict()
post_dict['id']= randrange(0,1000000)
my_posts.append(post_dict)
return{"data": post_dict}
it shows that post.dict() has got depreciated and can no longer be used,instead it shows the post.model_dump() to be used to convert it into dict which is not working for me and I am stuck.Can someone please help me out ? Thanks in advance