

def get_type_relationships(self, obj):
    relations = OrderedDict()
    relations['no_damage_to'] = []
    relations['half_damage_to'] = []
    relations['double_damage_to'] = []
    relations['no_damage_from'] = []
    relations['half_damage_from'] = []
    relations['double_damage_from'] = []
    results = TypeEfficacy.objects.filter(damage_type=obj)
    serializer = TypeEfficacySerializer(results, many=True, context=self.context)
    for relation in serializer.data:
        type = Type.objects.get(pk=relation['target_type'])
        if (relation['damage_factor'] == 200):
            relations['double_damage_to'].append(TypeSummarySerializer(type, context=self.context).data)
        elif (relation['damage_factor'] == 50):
            relations['half_damage_to'].append(TypeSummarySerializer(type, context=self.context).data)
        elif (relation['damage_factor'] == 0):
            relations['no_damage_to'].append(TypeSummarySerializer(type, context=self.context).data)
    results = TypeEfficacy.objects.filter(target_type=obj)
    serializer = TypeEfficacySerializer(results, many=True, context=self.context)
    for relation in serializer.data:
        type = Type.objects.get(pk=relation['damage_type'])
        if (relation['damage_factor'] == 200):
            relations['double_damage_from'].append(TypeSummarySerializer(type, context=relations.context).data)
        elif (relation['damage_factor'] == 50):
            relations['half_damage_from'].append(TypeSummarySerializer(type, context=self.context).data)
        elif (relation['damage_factor'] == 0):
            relations['no_damage_from'].append(TypeSummarySerializer(type, context=self.context).data)
    return relations

dataset/ETHPy150Open phalt/pokeapi/pokemon_v2/serializers.py TypeDetailSerializer.get_type_relationships/VarMisuse@304/424 `self`->`relations`