mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-22 19:33:10 +00:00
Merge pull request #517 from nairraghav/master
This commit is contained in:
commit
03b2bc5fd7
5 changed files with 38 additions and 0 deletions
|
@ -1278,6 +1278,8 @@ def _build_pokemons():
|
|||
has_gender_differences=bool(int(info[13])) if info[13] != "" else False,
|
||||
growth_rate_id=int(info[14]) if info[14] != "" else None,
|
||||
forms_switchable=bool(int(info[15])) if info[15] != "" else None,
|
||||
is_legendary=bool(int(info[16])) if info[16] != "" else None,
|
||||
is_mythical=bool(int(info[17])) if info[17] != "" else None,
|
||||
order=int(info[18]) if info[18] != "" else None,
|
||||
)
|
||||
|
||||
|
|
23
pokemon_v2/migrations/0007_auto_20200815_0610.py
Normal file
23
pokemon_v2/migrations/0007_auto_20200815_0610.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 2.1.11 on 2020-08-15 05:10
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("pokemon_v2", "0006_auto_20200725_2205"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="pokemonspecies",
|
||||
name="is_legendary",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="pokemonspecies",
|
||||
name="is_mythical",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
|
@ -1635,6 +1635,10 @@ class PokemonSpecies(
|
|||
|
||||
is_baby = models.BooleanField(default=False)
|
||||
|
||||
is_legendary = models.BooleanField(default=False)
|
||||
|
||||
is_mythical = models.BooleanField(default=False)
|
||||
|
||||
hatch_counter = models.IntegerField(blank=True, null=True)
|
||||
|
||||
has_gender_differences = models.BooleanField(default=False)
|
||||
|
|
|
@ -2984,6 +2984,8 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer):
|
|||
"capture_rate",
|
||||
"base_happiness",
|
||||
"is_baby",
|
||||
"is_legendary",
|
||||
"is_mythical",
|
||||
"hatch_counter",
|
||||
"has_gender_differences",
|
||||
"forms_switchable",
|
||||
|
|
|
@ -1462,6 +1462,8 @@ class APIData:
|
|||
hatch_counter=10,
|
||||
has_gender_differences=True,
|
||||
forms_switchable=False,
|
||||
is_legendary=False,
|
||||
is_mythical=False,
|
||||
order=1,
|
||||
):
|
||||
|
||||
|
@ -1499,6 +1501,8 @@ class APIData:
|
|||
has_gender_differences=has_gender_differences,
|
||||
growth_rate=growth_rate,
|
||||
forms_switchable=forms_switchable,
|
||||
is_legendary=is_legendary,
|
||||
is_mythical=is_mythical,
|
||||
order=order,
|
||||
)
|
||||
pokemon_species.save()
|
||||
|
@ -4560,6 +4564,9 @@ class APITests(APIData, APITestCase):
|
|||
response.data["base_happiness"], pokemon_species.base_happiness
|
||||
)
|
||||
self.assertEqual(response.data["is_baby"], pokemon_species.is_baby)
|
||||
self.assertEqual(response.data["is_legendary"], pokemon_species.is_legendary)
|
||||
self.assertEqual(response.data["is_mythical"], pokemon_species.is_mythical)
|
||||
|
||||
self.assertEqual(response.data["hatch_counter"], pokemon_species.hatch_counter)
|
||||
self.assertEqual(
|
||||
response.data["has_gender_differences"],
|
||||
|
|
Loading…
Reference in a new issue