MCPcopy Create free account
hub / github.com/PokeAPI/pokeapi / get_species

Method get_species

pokemon_v2/serializers.py:5200–5213  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

5198 }
5199 )
5200 def get_species(self, obj):
5201 evo_objects = PokemonEvolution.objects.filter(evolution_trigger=obj)
5202 species_list = []
5203 species_names = set()
5204
5205 for evo in evo_objects:
5206 species = PokemonSpeciesSummarySerializer(
5207 evo.evolved_species, context=self.context
5208 ).data
5209 if species["name"] not in species_names:
5210 species_list.append(species)
5211 species_names.add(species["name"])
5212
5213 return species_list
5214
5215
5216class PokemonSpeciesDescriptionSerializer(serializers.ModelSerializer):

Callers

nothing calls this directly

Tested by

no test coverage detected