Posts tagged django rest framework

Nested Serialization in Django REST Framework

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.

Read more ...


Setup Django for Testing with pytest

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.

Read more ...


Django Testing Cookbook

In this cookbook we are focusing on testing Django with pytest.

Read more ...


Setup the Project for Django REST Framework

Install Django REST Framework and implement Swagger interface for the API.

Read more ...