'DRF: How do you create multiple "detail" views for a model?

I have a django model that has multiple fields that need to be used as a key, and also has some detail views.

For example, my endpoints currently look like this, using detail=True to get the second set:

my.api/things/{id_1} (GET, POST, DELETE)
my.api/things/{id_1}/whatever (GET, POST)

That's all great, but I have to get to something that looks like this instead:

my.api/things/{id_1} (GET, POST, DELETE)
my.api/things/{id_1}/whatever (GET, POST)

my.api/things/other_id/{id_2} (GET, POST, DELETE)
my.api/things/other_id/{id_2}/whatever (GET, POST)

If it helps, the set of detail endpoints (ie. whatever) is identical, and there's no difference in functionality between the two. I just need to be able to access the database through either field.

I'm new to django so I'm sorry if this is a simple question. Any help would be appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source