I’m using the ContentType framework and GenericForeignKeys with Django. When embedding the
content_object into an object field for serialization– is it better to embed it as a field named
content_object? Or as a named field that’s injected?
So for example, let’s say I have notifications with a loosely associated object:
- Inject a
typefield for the client to consume, with types like
ALERTand so on.
- Inject a relevant object, like
- Infer the type from the content_type field. However this will be unreadable, so the client will simply need to know this enum.
- Injet the relevant
content_objectfield but keep it named
content_object, switching off of the