我们还可以说,我已经为上面的代码创建了顶级ViewSets和序列化程序。很简单。现在,我想创建一个自定义端点(detail_route),它基于ThingTwo的子集,并包含来自ThingOne和ThingThree的相应字段。我将使用定制的序列化程序来打包我的数据:
field1 = serializers.SerializerMethodFieldclass Meta
related_name="billable_and_non_billable+") def __str__(self):序列化器models.Consolidated.objects.all()实际上,我被塞在中间,因为我需要从Users模型中获取‘Users’字段中的值,并在Consolidated model bi