π Django REST Framework π
Posted on Mar 25th, 2021
Todayβs Topics
Today we are going to dive into the Django REST Framework.
π― Project
Add an API to Habit Tracker. (note: There is no assignment repo or README for this.)
Add a new app to your existing Habit Tracker project and call it api. By the end of the week, your app should provide CRUD endpoints in JSON.
By Friday afternoon, you should be able to list, create, update, and delete habits.
By Monday, you should be able to complete all CRUD tasks through the API:
- list habits
- create a new habit
- view a habit
- update a habit
- delete a habit
- list records for a habit (on the habit detail API endpoint)
- create a record for a habit
- update a record for a habit
- delete a record from a habit
You should develop and test your endpoints using Insomnia. (If you want to change it up you can also play with another popular tool for building and testing APIs called Postman).
Your application should be deployed to Heroku.
π Read | πΊ Watch | π§ Listen
- DRF class-based views This talks about
APIView. - Class-based vs. function-based views This is about Django views in general, not specific to DRF.
- What You Should Know About DRF, Lacey Williams Henschel, PyCascades 2021
π Resources
- Django REST Framework Documentation
- Classy Django REST Framework
- django-extensions shell_plus
- Python
pprintmodule docs - Example code from class