Imported from ku5ic/dotfiles (
claude/skills/drf-patterns/SKILL.md). Install upstream withnpx skills add ku5ic/dotfiles --skill drf-patterns. Copyright stays with the author.
Django REST Framework patterns
DRF 3.18.x. Supports Django 5.2, 6.0, and 6.1; 3.18.0 dropped Django 4.2, 5.0, and 5.1. Verify current version at https://pypi.org/project/djangorestframework/. Adapt advice to the version in the project's requirements.txt, pyproject.toml, or lockfile.
Reference files
| File | Covers |
|---|---|
| serializers.md | Explicit fields, validate(), nested serializers, SerializerMethodField, ModelSerializer |
| viewsets-and-routers.md | ModelViewSet vs GenericViewSet + mixins, @action, DefaultRouter |
| permissions.md | permission_classes, IsAuthenticated vs IsAuthenticatedOrReadOnly, object-level permissions |
| throttling-and-pagination.md | UserRateThrottle, AnonRateThrottle, pagination styles, page size config |
| filtering.md | django-filter, SearchFilter, OrderingFilter, get_queryset override |
| auth.md | TokenAuthentication, SessionAuthentication, JWT via simplejwt |
| versioning.md | Versioning schemes, request.version, ALLOWED_VERSIONS |
| anti-patterns.md | Severity-labeled anti-patterns to flag in review |
References
- https://www.django-rest-framework.org/
- https://www.django-rest-framework.org/api-guide/serializers/
- https://www.django-rest-framework.org/api-guide/permissions/
- https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
Version notes
Checked: 2026-09-12 against https://pypi.org/project/djangorestframework/ and https://www.django-rest-framework.org/community/release-notes/
- 3.18.1 (2026-09-07): 3.18.0 dropped Django 4.2, 5.0, 5.1. A project pinned to one of those stays on 3.17.
- 3.14:
NullBooleanFieldremoved; useBooleanField(allow_null=True). - 3.5:
ModelSerializerwithoutfieldsorexcludebecame an error (deprecated since 3.3).