In the last assignment, we showed you how to use Django Rest Framework to set up your own API. In this part, we'll ask you to create the API for both Post and Comment objects so that you can get some good hands-on practice :). We'll include our sample solutions following each section as well as a through explanation. We'll also cover some important security principles and implement the voting logic together.
Part of course:
Hands-on Assignment: Creating an API Part 2
- Step 1: Post API
- Create the initial Serializer
- Create the initial ViewSet
- Testing Creating Posts
- Allowing Posts to be Edited via the API
- Testing Modifying Posts
- Listing Posts
- Step 2: Comments
- Voting
- Handling Upvotes and Downvotes
- Conclusion
- Next Steps
Show admin stats