Generate Django REST Framework viewsets with serializers and permissions
Create Django REST Framework viewset for:
Model Name: {{MODEL_NAME}}
Features: {{FEATURES}} (CRUD/filtering/pagination/nested)
Authentication: {{AUTH}}
Generate complete DRF structure:
1. **Models (models.py):**
- Model definition
- Field definitions
- Meta class
- Model methods
- Managers
2. **Serializers (serializers.py):**
- ModelSerializer
- Nested serializers
- Custom fields
- Validation methods
- Create/update overrides
- SerializerMethodField
3. **ViewSets (views.py):**
- ModelViewSet
- Custom actions
- Permission classes
- Filter backends
- Pagination
- Queryset optimization
4. **Permissions (permissions.py):**
- Custom permission classes
- Object-level permissions
- Action-based permissions
5. **Filters (filters.py):**
- FilterSet definition
- Filter fields
- Custom filters
- Search fields
- Ordering fields
6. **URLs (urls.py):**
- Router registration
- Custom URL patterns
- Nested routers
7. **Tests (tests.py):**
- APITestCase
- Factory setup
- CRUD tests
- Permission tests
- Filter tests
8. **Admin (admin.py):**
- ModelAdmin
- Inline admins
- Custom actions
Include OpenAPI schema customization.Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{MODEL_NAME][{FEATURES][{AUTH]