mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-10 14:14:17 +00:00
evolution-chain bug fix
This commit is contained in:
parent
342ea98b87
commit
300f1a9b79
1 changed files with 8 additions and 5 deletions
|
@ -2662,14 +2662,17 @@ class EvolutionChainDetailSerializer(serializers.ModelSerializer):
|
|||
|
||||
entry = OrderedDict()
|
||||
|
||||
evolution_object = PokemonEvolution.objects.get(evolved_species=species['id'])
|
||||
evolution_data = PokemonEvolutionSerializer(evolution_object, context=self.context).data
|
||||
|
||||
print evolution_data
|
||||
many=False
|
||||
try:
|
||||
evolution_object = PokemonEvolution.objects.get(evolved_species=species['id'])
|
||||
except PokemonEvolution.MultipleObjectsReturned:
|
||||
evolution_object = PokemonEvolution.objects.filter(evolved_species=species['id'])
|
||||
many=True
|
||||
|
||||
evolution_data = PokemonEvolutionSerializer(evolution_object, many=many, context=self.context).data
|
||||
|
||||
current_evolutions.append(entry)
|
||||
|
||||
|
||||
entry['is_baby'] = species['is_baby']
|
||||
entry['species'] = summary_data[index]
|
||||
if evolution_data: entry['evolution_details'] = evolution_data
|
||||
|
|
Loading…
Reference in a new issue