{"enrichment":{"faq":[{"a":"django-drf ViewSets combine related views into a single class, reducing boilerplate. ModelViewSet provides full CRUD operations automatically. Basic example: inherit from ModelViewSet, set queryset and serializer_class, then register with a router. ViewSets handle list, create, retrieve, update, and destroy actions. Use @action decorator for custom endpoints. This pattern is central to building production APIs efficiently.","q":"What are django-drf ViewSet examples and how do I use them?"},{"a":"django-drf simplifies REST API development through ViewSets, Serializers, and routers. Define models, create Serializers to handle data validation and transformation, build ViewSets to handle HTTP requests, then register routes with DefaultRouter. Add filtering, permissions, and pagination in settings. Use token or JWT authentication for security. Test endpoints with pytest or the browsable API. This structured approach ensures scalable, maintainable APIs.","q":"How do I build a REST API with Django and django-drf?"},{"a":"django-drf supports multiple serializer patterns: use one serializer for list/retrieve and another for create/update operations, implement SerializerMethodField for computed properties, set read_only_fields for output-only data, and use nested serializers for relationships. Create separate serializers when input validation differs from output format. Override to_representation() and to_internal_value() for custom logic. These patterns ensure clean separation of concerns and robust validation.","q":"What are the key django-drf serializer patterns for different operations?"},{"a":"django-drf filtering uses DjangoFilterBackend with filterset_fields or custom FilterSet classes. Permissions are applied via permission_classes on ViewSets\u2014use IsAuthenticated, IsAdminUser, or custom classes like IsOwner. Pagination is configured globally in settings with DEFAULT_PAGINATION_CLASS and PAGE_SIZE, or per-ViewSet. Combine these in ViewSet: set filter_backends, permission_classes, and pagination_class. This ensures secure, scalable APIs with controlled data access.","q":"How do I set up filtering, permissions, and pagination in django-drf?"},{"a":"django-drf testing uses APITestCase or pytest fixtures to create test clients and authenticate users. Test each ViewSet action: list, create, retrieve, update, destroy. Verify status codes, response data, and side effects. Use factories for test data, mock external services, and test permissions by making requests as different users. Test serializer validation separately. This comprehensive approach catches bugs early and ensures API reliability.","q":"How do I test django-drf endpoints and API logic effectively?"},{"a":"django-drf ViewSet is a base class requiring manual action definition; ModelViewSet extends it with automatic CRUD actions (list, create, retrieve, update, destroy, partial_update). Use ModelViewSet for standard database operations, ViewSet for custom logic or non-database endpoints. Both work with routers for automatic URL generation. Choose based on your needs: ModelViewSet saves code for typical resources, ViewSet offers flexibility for complex scenarios.","q":"What is the difference between django-drf ModelViewSet and ViewSet?"}],"shadow_tags":["api-development","rest-patterns","backend-framework","request-handling","data-validation","access-control","test-automation","query-filtering","response-formatting","endpoint-routing"],"summary_rewrite":"Learn proven Django REST Framework patterns for building scalable APIs. This skill covers ViewSets, Serializers for different operations, filtering strategies, custom permissions, pagination setup, and routing conventions. Includes testing patterns and common management commands."},"files":[{"bytes":4636,"path":"curated/django-drf/SKILL.md","sha256":"342035c72a13951dfad850655e34d149724ae4aebc9c4f41e652dbc18ce2ad4f","url":"https://skillfed.io/files/Gentleman-Programming/Gentleman-Skills/django-drf/761c5887/SKILL.md"}],"id":"Gentleman-Programming/Gentleman-Skills/django-drf","links":{"html":"https://skillfed.io/Gentleman-Programming/Gentleman-Skills/django-drf","md":"https://skillfed.io/Gentleman-Programming/Gentleman-Skills/django-drf.md","repo":"https://github.com/Gentleman-Programming/Gentleman-Skills"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":88,"language":null,"last_updated":"2026-03-28","license":"MIT","name":"django-drf","publisher":"Gentleman-Programming","stars":604},"relations":{"similar":[{"id":"personamanagmentlayer/pcl/django-expert"},{"id":"prowler-cloud/prowler/django-drf"},{"id":"Jeffallan/claude-skills/django-expert"},{"id":"xu-xiang/everything-claude-code-zh/django-tdd"},{"id":"bobmatnyc/claude-mpm-skills/django"},{"id":"affaan-m/ECC/django-tdd"},{"id":"xu-xiang/everything-claude-code-zh/django-patterns"},{"id":"affaan-m/ECC/django-patterns"},{"id":"xu-xiang/everything-claude-code-zh/api-design"},{"id":"majesticlabs-dev/majestic-marketplace/django-coder"}]},"slug":{"owner":"Gentleman-Programming","repo":"Gentleman-Skills","skill":"django-drf"},"version":"761c5887"}
