Django rest API crud example with unit testing
Published in
2 min readFeb 3, 2021
Hi, in this article I am going to show you what are the different ways of creating crud in the Django rest framework with the unit testing.
- Function-based crud
- class-based API view crud
- Generic class-based view crud
- Generic class-based view with views router crud
- Viewset crud
- ModelViewset crud
1. Function-based crud
as above shows everything is simple and line by line and two URLs added at the bottom for unit case check GitHub repo.
2. class-based API view crud
Class-based API views inhered from view class so it has GET, POST, etc.. methods