---
title: "Blog"
url: "https://nareshkumar.online/blog"
author: "Naresh Kumar"
---

# Blog

- [DRF Serializers Done Right: Validation, Nested Writes and Speed](https://nareshkumar.online/blog/drf-serializers-validation-nested-writes.md) (2026-10-05) — Shape fields with read_only, write_only and source. Validate single values in validate_<field> and cross-field rules in validate(). Write nested data yourself inside transaction.atomic, and keep queries out of SerializerMethodField.
- [Authentication, Permissions and JWT in Django REST Framework](https://nareshkumar.online/blog/drf-authentication-permissions-jwt.md) (2026-10-05) — Authentication identifies the caller, permissions decide what they may do, and throttling limits how often they can try. Default to IsAuthenticated, scope get_queryset() to the user, add object permissions for detail views, and throttle logins.
- [Pagination, Filtering and Search in Django REST Framework](https://nareshkumar.online/blog/drf-pagination-filtering-search.md) (2026-10-05) — Paginate every list endpoint. Use page numbers for small tables and cursors for large or fast-changing ones. Filter with django-filter, whitelist ordering fields, cap page sizes, and index the columns clients filter and sort on.
- [Fix N+1 Queries in Django with select_related and prefetch_related](https://nareshkumar.online/blog/django-n-plus-one-queries.md) (2026-10-05) — An N+1 query runs one query for a list and one more for every row. Use select_related for foreign keys, prefetch_related for many-to-many and reverse relations, annotate counts in the database, and pin the query count in a test.
- [Testing Django REST Framework APIs with pytest](https://nareshkumar.online/blog/testing-drf-apis-with-pytest.md) (2026-10-05) — Use pytest-django with APIClient fixtures and factory_boy factories. Test status codes, payloads and permissions for every endpoint, pin query counts, keep the suite fast, and run it against PostgreSQL in CI.
