[Answered ]-Composite keys in Django Rest Framework?

2👍

You can generate the custom urls using the lookup_fields. Can you follow this link below here Multiple LookUp Args and Custom Urls.

0👍

The key phrase I was missing was “nested router” or “nested resource” – the VLANs are nested inside the location object. Thinking of the resources instead of the database makes this clearer.

This functionality is provided by both the drf-nested-routers and drf-extensions packages. I will be giving drf-extensions a try, since it seems a little more mature (no “this is WIP” banner at the top!).

Leave a comment