MCPcopy
hub / github.com/PokeAPI/pokeapi / get_learned_by_pokemon

Method get_learned_by_pokemon

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

Source from the content-addressed store, hash-verified

3320 }
3321 )
3322 def get_learned_by_pokemon(self, obj):
3323 pokemon_moves = PokemonMove.objects.filter(move_id=obj).order_by("pokemon_id")
3324
3325 pokemon_list = []
3326
3327 pokemon_ids = pokemon_moves.values("pokemon_id").distinct()
3328
3329 for id in pokemon_ids:
3330 pokemon_object = Pokemon.objects.get(pk=id["pokemon_id"])
3331 pokemon_data = PokemonSummarySerializer(
3332 pokemon_object, context=self.context
3333 ).data
3334
3335 pokemon_list.append(pokemon_data)
3336
3337 return pokemon_list
3338
3339 @extend_schema_field(
3340 field={

Callers

nothing calls this directly

Calls 2

getMethod · 0.80

Tested by

no test coverage detected