Need help with creating RESTful APIs for a generic relationship in Django

Hello everyone,

I’m currently working on creating a RESTful API in Django, and I’m facing a challenge with implementing a generic relationship between my apps. Specifically, I have an app called “Damages” that needs to have multiple relationships with models from both the “Stock” app and another app.

I followed the examples provided in the “Ultimate Django” series, which helped me implement the relationship successfully on the admin side. However, I’m now struggling to create APIs that can handle this functionality.

I’ve tried various approaches suggested by Django Rest Framework (DRF), but I’m encountering errors. My goal is to have the flexibility to choose the relationship either statically or dynamically and apply CRUD functionality to the relevant table.

If anyone has experience with generic relationships in Django and creating RESTful APIs for them, I would greatly appreciate your guidance and recommendations. Are there any specific resources, tutorials, or examples that could help me overcome this challenge effectively?

Thank you in advance for your assistance. I’m looking forward to hearing your insights and suggestions.