#django-rest-framework

[ follow ]
Web frameworks
fromDjangocentral
1 year ago

DRF Serializer: Handling OrderedDict and Converting It to a Dictionary or JSON

DRF serializer.data returns an OrderedDict to preserve serializer field order; convert to a standard dict with dict(serializer.data) if needed.
fromDjangocentral
1 year ago

How to Use @action Decorator in Django Rest Framework

Django Rest Framework (DRF) provides powerful tools to build robust APIs. While the standard CRUD operations are usually sufficient, there are cases where you might need to add custom actions or endpoints to perform specific operations. This is where the @action decorator comes into play, allowing you to extend your ViewSets with additional functionalities. In this article, we will explore the concept of @action and demonstrate how to create custom actions using the GET and POST methods with practical code examples.
fromdjangocentral.com
6 days ago
Web frameworks

The Ultimate Django Rest Framework Cheat Sheet: A Comprehensive GuideDjango Rest Framework CheetSheet: Mastering API Development

DRF serializer.data returns OrderedDicts by design; Django ORM supports NOT queries using ~ with Q objects and abstracts SQL through Python models.
[ Load more ]