Build a complete Django REST Framework API with serializers, viewsets, permissions, and authentication.
Design a Django REST Framework API for the following application: Application Domain: [E-COMMERCE/SaaS/SOCIAL/CMS/MARKETPLACE] Core Resources: [LIST 3-5 MAIN MODELS] Authentication: [SESSION/TOKEN/JWT/OAUTH2] User Roles: [ADMIN/STAFF/CUSTOMER/PUBLIC] API Versioning: [URL/HEADER/QUERY PARAM] Expected Traffic: [LOW/MEDIUM/HIGH] Build the complete API layer covering: 1. Model design with proper field types, validators, database indexes, and relationship definitions including many-to-many through models, ensuring data integrity with constraints and default ordering 2. Serializer architecture using nested serializers for related objects, separate read and write serializers for complex resources, custom validation methods, and computed fields using SerializerMethodField for derived data 3. ViewSet implementation with ModelViewSet for full CRUD, custom actions using the action decorator for non-standard operations, filtering with django-filter, search functionality, and ordering configuration 4. Permission classes combining IsAuthenticated, custom object-level permissions for ownership checks, and role-based access control that restricts endpoints based on user type and resource ownership 5. Pagination strategy choosing between PageNumberPagination, LimitOffsetPagination, or CursorPagination based on dataset characteristics, with consistent response envelope formatting 6. Testing approach with APITestCase covering authentication flows, permission boundaries, validation errors, pagination, filtering, and edge cases using factory_boy for test data generation Include URL configuration, settings modifications, and deployment considerations for production readiness.
Or press ⌘C to copy