I have three different models that I want to gather in a feed type page. They do all contain different types of things but for simplicity, the models are the same in this instance.
class ObjectA(models.Model):
text = models.TextField()
pub_date = models.DateTimeField('date published',auto_now_add=True)
...
class ObjectB(models.Model):
text = models.TextField()
pub_date = models.DateTimeField('date published',auto_now_add=True)
...
class ObjectC(models.Model):
text = models.TextField()
pub_date = models.DateTimeField('date published',auto_now_add=True)
...
What would be the general idea to serialize lists of all three objects into one list ordered by pub_date using the Django REST Framework. I just have experience using the meta version below but it can only deal with one model I am assuming. Thanks in advance.
class ObjectAListSerializer(serializers.ModelSerializer):
class Meta:
model = ObjectA
fields = [
'text',
'pub_date'
]
Pretty much trying to create something that would work like this:
class AllObjectsListSerializer(serializers.ModelSerializer):