Итоговый Api не включает все сериализованные данные
InstagramGeograficsSerializerclass InstagramGeograficsSerializer(serializers.ModelSerializer):
city = InstagramGeoCitySerializer(read_only=True)
class Meta:
model = InstagramGeograficsAnalitics
fields = ('city', 'percentage',)
InstagramEthnicSerializerclass InstagramEthnicSerializer(serializers.ModelSerializer):
class Meta:
model = InstagramEthnicAnalitics
fields = ('language', 'percentage',)
InstagramDemographicsSerializerclass InstagramDemographicsSerializer(serializers.ModelSerializer):
class Meta:
model = InstagramDemographicsAnalitics
fields = ('age_group', 'gender', 'percentage', 'full_percentage',)
InstagramSerializerclass InstagramSerializer(serializers.HyperlinkedModelSerializer):
geographics = InstagramGeograficsSerializer(many=True, read_only=True)
demographics = InstagramDemographicsSerializer(many=True, read_only=True)
ethnic = InstagramEthnicSerializer(many=True, read_only=True)
class Meta:
model = Instagram
fields = ('id', 'userid', 'username', 'full_name', 'avatar', 'bio',
'website', 'media_count', 'follows_count',
'subscriber_count', 'engagement_rate', 'approval_rate',
'discussion_rate', 'male_percentage', 'female_percentage', 'geographics', 'demographics', 'ethnic',)
views.pyclass InstagramDetail(generics.RetrieveAPIView):
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
queryset = Instagram.objects.all()
serializer_class = InstagramSerializer
В итоге API отдает данные по
ethnic, но не содержит данные по
geographics and
demographics{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"userid": "3045727148",
"username": "test2",
"full_name": "full name",
"avatar": "",
"bio": "23",
"website": "",
"media_count": 0,
"follows_count": 0,
"subscriber_count": 0,
"engagement_rate": "0.0000000",
"approval_rate": "0.0000000",
"discussion_rate": "0.0000000",
"male_percentage": "0.000",
"female_percentage": "0.000",
"ethnic": []
}