Posts tagged django rest framework
Nested Serialization in Django REST Framework
- 16 September 2023
In case you are serializing a model with relationships the default ModelSerializer behavior is to provide the primary key of the relationship target. In case you need to serialize the target object not just the primary key, you have (at least) two options: explicit nested serializer and implicit nested serializer using depth.
Setup Django for Testing with pytest
- 10 September 2023
Test Driven Development is a popular software development practice which helps in creating better software. The practice that I prefer is a little bit relaxed practice that I call Test Assisted Development as sometimes tests are not written before the production code (but let’s leave this discussion for another place and time). Django projects also need to be thoroughly tested. Let’s configure our Django project for testing with pytest before even creating the first Django application.
Django Testing Cookbook
- 10 September 2023
In this cookbook we are focusing on testing Django with pytest.
Setup the Project for Django REST Framework
- 09 September 2023
Install Django REST Framework and implement Swagger interface for the API.