In this chapter, we defined the requirements for a complex RESTful Web Service in which we needed to work with drone categories, drones, pilots, and competitions. We created a new app with Django and configured the new web service.
We defined many-to-one relationships between the models with
models.ForeignKey. We configured Django to work with a PostgreSQL database. We executed migrations that generated tables with relationships between them. We analyzed the generated database and we configured serialization and deserialization for the models. We declared two serializers for a single model to understand the flexibility we have with Django and the Django REST framework.
We defined hyperlinks with the help of the
HyperlinkedModelSerializer class and we worked with class-based views. In this case, we took advantage of generic classes and generic views that generalize and mix predefined behaviors. We worked with routings and endpoints and we prepared our RESTful Web Service to work with...