Merge branch 'master' into compose-v2

This commit is contained in:
Alessandro Pezzè 2024-05-08 21:14:35 +02:00 committed by GitHub
commit 79a8d2bfaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 12783 additions and 3372 deletions

View file

@ -20,6 +20,9 @@ jobs:
- run:
name: Run tests
command: make test
- run:
name: Generate OpenAPI schema
command: make openapi-generate
build:
docker:
- image: cimg/python:3.10.9

View file

@ -35,7 +35,7 @@ jobs:
context: .
file: ./Resources/docker/app/Dockerfile
push: false
platforms: local
platforms: local,linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest

View file

@ -13,21 +13,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
pokeapi/pokeapi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
@ -43,12 +43,12 @@ jobs:
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: ./Resources/docker/app/Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7,linux/arm/v6
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest

View file

@ -41,6 +41,9 @@ make-migrations: # Create migrations files if schema has changed
shell: # Load a shell
python manage.py shell ${local_config}
openapi-generate:
python manage.py spectacular --color --file openapi.yml ${local_config}
docker-up: # (Docker) Create services/volumes/networks
docker compose up -d
@ -140,10 +143,10 @@ update-graphql-data-prod:
git submodule update --init
docker compose stop graphql-engine
sync; echo 3 > /proc/sys/vm/drop_caches
docker compose -f docker-compose.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d app
docker compose -f docker-compose.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d app cache
make docker-migrate
make docker-build-db
docker compose stop app
docker compose stop app cache
sync; echo 3 > /proc/sys/vm/drop_caches
docker compose exec -T web sh -c 'rm -rf /tmp/cache/*'
docker compose start graphql-engine

View file

@ -1,5 +1,8 @@
version: '2.4'
services:
cache:
restart: "no"
db:
environment:
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"

View file

@ -7,9 +7,9 @@ RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN \
apk add --no-cache postgresql-libs libstdc++ && \
apk add --no-cache --virtual .build-deps gcc g++ musl-dev postgresql-dev && \
RUN apk add --no-cache postgresql-libs libstdc++
RUN apk add --no-cache --virtual .build-deps gcc g++ musl-dev \
postgresql-dev rust cargo && \
python3 -m pip install -r requirements.txt --no-cache-dir && \
apk --purge del .build-deps
ADD . /code/

View file

@ -99,6 +99,7 @@ INSTALLED_APPS = (
"corsheaders",
"rest_framework",
"cachalot",
"drf_spectacular",
) + CUSTOM_APPS
@ -116,6 +117,7 @@ REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"PAGE_SIZE": 20,
"PAGINATE_BY": 20,
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}
@ -136,3 +138,42 @@ TEMPLATES = [
]
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
SPECTACULAR_SETTINGS = {
"TITLE": "PokéAPI",
"DESCRIPTION": """All the Pokémon data you'll ever need in one place, easily accessible through a modern free open-source RESTful API.
## What is this?
This is a full RESTful API linked to an extensive database detailing everything about the Pokémon main game series.
We've covered everything from Pokémon to Berry Flavors.
## Where do I start?
We have awesome [documentation](https://pokeapi.co/docs/v2) on how to use this API. It takes minutes to get started.
This API will always be publicly available and will never require any extensive setup process to consume.
Created by [**Paul Hallett**(]https://github.com/phalt) and other [**PokéAPI contributors***](https://github.com/PokeAPI/pokeapi#contributing) around the world. Pokémon and Pokémon character names are trademarks of Nintendo.
""",
"SERVERS": [{"url": "https://pokeapi.co"}],
"EXTERNAL_DOCS": {"url": "https://pokeapi.co/docs/v2"},
"VERSION": "2.7.0",
"SERVE_INCLUDE_SCHEMA": False,
"OAS_VERSION": "3.1.0",
"COMPONENT_SPLIT_REQUEST": True,
"TAGS": [
"pokemon",
"evolution",
"berries",
"items",
"machines",
"location",
"contest",
"moves",
"encounters",
"games",
"utility",
],
}

View file

@ -13,6 +13,7 @@ middleware here, or combine a Django application with an application of another
framework.
"""
import os
from django.core.wsgi import get_wsgi_application

View file

@ -1242,9 +1242,11 @@ def _build_locations():
id=int(info[0]),
location_id=int(info[1]),
game_index=int(info[2]),
name="{}-{}".format(location.name, info[3])
if info[3]
else "{}-{}".format(location.name, "area"),
name=(
"{}-{}".format(location.name, info[3])
if info[3]
else "{}-{}".format(location.name, "area")
),
)
build_generic((LocationArea,), "location_areas.csv", csv_record_to_objects)

View file

@ -3,8 +3,8 @@ evolution_trigger_id,local_language_id,name
1,6,Levelaufstieg
1,9,Level up
2,5,Échange
2,6,Tausch
2,9,Trade
2,6,Tausch oder Verbindungsschnur
2,9,Trade or Linking Cord
3,5,Utilisation d'un objet
3,6,Gegenstand nutzen
3,9,Use item

1 evolution_trigger_id local_language_id name
3 1 6 Levelaufstieg
4 1 9 Level up
5 2 5 Échange
6 2 6 Tausch Tausch oder Verbindungsschnur
7 2 9 Trade Trade or Linking Cord
8 3 5 Utilisation d'un objet
9 3 6 Gegenstand nutzen
10 3 9 Use item

View file

@ -610,3 +610,7 @@ item_id,item_flag_id
303,7
304,5
304,7
2160,1
2160,2
2160,3
2160,5
1 item_id item_flag_id
610 303 7
611 304 5
612 304 7
613 2160 1
614 2160 2
615 2160 3
616 2160 5

View file

@ -17822,3 +17822,5 @@ item_id,local_language_id,name
2159,1,チャデスのこな
2159,9,Poltchageist Powder
2159,11,チャデスのこな
2160,9,Linking Cord
2160,11, つながりのヒモ
1 item_id local_language_id name
17822 2159 1 チャデスのこな
17823 2159 9 Poltchageist Powder
17824 2159 11 チャデスのこな
17825 2160 9 Linking Cord
17826 2160 11 つながりのヒモ

View file

@ -1519,3 +1519,4 @@ This item can only be obtained or used via the Wonder Launcher."
1003,9,XXX new effect for roto-pp-restore,XXX new effect for roto-pp-restore
1004,9,XXX new effect for roto-boost,XXX new effect for roto-boost
1005,9,XXX new effect for roto-catch,XXX new effect for roto-catch
2160,9,Allows a Pokemon whose evolution is usually triggered by trading to evolve, The Linking Cord triggers the evolution of certain Pokémon (all of which can alternatively evolve when traded) upon use. This consumes the Linking Cord.

1 item_id local_language_id short_effect effect
1519
1520
1521
1522

View file

@ -2107,5 +2107,6 @@ id,identifier,category_id,cost,fling_power,fling_effect_id
2157,cramorant-down,54,30,,
2158,morpeko-snack,54,15,,
2159,poltchageist-powder,54,30,,
2160,linking-cord,10,8000,,
10001,black-augurite,10,0,,
10002,peat-block,10,0,,

1 id identifier category_id cost fling_power fling_effect_id
2107 2157 cramorant-down 54 30
2108 2158 morpeko-snack 54 15
2109 2159 poltchageist-powder 54 30
2110 2160 linking-cord 10 8000
2111 10001 black-augurite 10 0
2112 10002 peat-block 10 0

View file

@ -719,12 +719,12 @@ id,identifier,generation_id,type_id,power,pp,accuracy,priority,target_id,damage_
718,multi-attack,7,1,120,10,100,0,10,2,269,,,,
719,10-000-000-volt-thunderbolt,7,13,195,1,,0,10,3,1,,,,
720,mind-blown,7,10,150,5,100,0,9,3,420,,,,
721,plasma-fists,7,13,100,15,100,0,10,2,1,,,,
721,plasma-fists,7,13,100,15,100,0,10,2,417,,,,
722,photon-geyser,7,14,100,5,100,0,10,3,1,,,,
723,light-that-burns-the-sky,7,14,200,1,,0,10,3,416,,,,
724,searing-sunraze-smash,7,9,200,1,,0,10,2,411,,,,
725,menacing-moonraze-maelstrom,7,8,200,1,,0,10,3,411,,,,
726,lets-snuggle-forever,7,18,190,1,,0,10,2,417,,,,
726,lets-snuggle-forever,7,18,190,1,,0,10,2,1,,,,
727,splintered-stormshards,7,6,190,1,,0,10,2,418,,,,
728,clangorous-soulblaze,7,16,185,1,,0,11,3,419,100,,,
729,zippy-zap,7,13,80,10,100,2,10,2,1,100,,,

1 id identifier generation_id type_id power pp accuracy priority target_id damage_class_id effect_id effect_chance contest_type_id contest_effect_id super_contest_effect_id
719 718 multi-attack 7 1 120 10 100 0 10 2 269
720 719 10-000-000-volt-thunderbolt 7 13 195 1 0 10 3 1
721 720 mind-blown 7 10 150 5 100 0 9 3 420
722 721 plasma-fists 7 13 100 15 100 0 10 2 1 417
723 722 photon-geyser 7 14 100 5 100 0 10 3 1
724 723 light-that-burns-the-sky 7 14 200 1 0 10 3 416
725 724 searing-sunraze-smash 7 9 200 1 0 10 2 411
726 725 menacing-moonraze-maelstrom 7 8 200 1 0 10 3 411
727 726 lets-snuggle-forever 7 18 190 1 0 10 2 417 1
728 727 splintered-stormshards 7 6 190 1 0 10 2 418
729 728 clangorous-soulblaze 7 16 185 1 0 11 3 419 100
730 729 zippy-zap 7 13 80 10 100 2 10 2 1 100

View file

@ -897,133 +897,133 @@ id,identifier,species_id,height,weight,base_experience,order,is_default
896,glastrier,896,22,8000,290,1088,1
897,spectrier,897,20,445,290,1089,1
898,calyrex,898,11,77,250,1090,1
899,wyrdeer,899,18,951,,,1
900,kleavor,900,18,890,,,1
901,ursaluna,901,24,2900,,,1
902,basculegion-male,902,30,1100,,,1
903,sneasler,903,13,430,,,1
904,overqwil,904,25,605,,,1
905,enamorus-incarnate,905,16,480,,,1
906,sprigatito,906,4,41,,906,1
907,floragato,907,9,122,,907,1
908,meowscarada,908,15,312,,908,1
909,fuecoco,909,4,98,,909,1
910,crocalor,910,10,307,,910,1
911,skeledirge,911,16,3265,,911,1
912,quaxly,912,5,61,,912,1
913,quaxwell,913,12,215,,913,1
914,quaquaval,914,18,619,,914,1
915,lechonk,915,5,102,,915,1
916,oinkologne,916,10,1200,,916,1
917,tarountula,917,3,40,,918,1
918,spidops,918,10,165,,919,1
919,nymble,919,2,10,,920,1
920,lokix,920,10,175,,921,1
921,pawmi,921,3,25,,954,1
922,pawmo,922,4,65,,955,1
923,pawmot,923,9,410,,956,1
924,tandemaus,924,3,18,,945,1
925,maushold,925,3,23,,946,1
926,fidough,926,3,109,,970,1
927,dachsbun,927,5,149,,971,1
928,smoliv,928,3,65,,935,1
929,dolliv,929,6,119,,936,1
930,arboliva,930,14,482,,937,1
931,squawkabilly,931,6,24,,960,1
932,nacli,932,4,160,,963,1
933,naclstack,933,6,1050,,964,1
934,garganacl,934,23,2400,,965,1
935,charcadet,935,6,105,,1003,1
936,armarouge,936,15,850,,1004,1
937,ceruledge,937,16,620,,1005,1
938,tadbulb,938,3,4,,940,1
939,bellibolt,939,12,1130,,941,1
940,wattrel,940,4,36,,957,1
941,kilowattrel,941,14,386,,958,1
942,maschiff,942,5,160,,972,1
943,mabosstiff,943,11,610,,973,1
944,shroodle,944,2,7,,968,1
945,grafaiai,945,7,272,,969,1
946,bramblin,946,6,6,,974,1
947,brambleghast,947,12,60,,975,1
948,toedscool,948,9,330,,1006,1
949,toedscruel,949,19,580,,1007,1
950,klawf,950,13,790,,962,1
951,capsakid,951,3,30,,938,1
952,scovillain,952,9,150,,939,1
953,rellor,953,2,10,,922,1
954,rabsca,954,3,35,,923,1
955,flittle,955,2,15,,926,1
956,espathra,956,19,900,,927,1
957,tinkatink,957,4,89,,1000,1
958,tinkatuff,958,7,591,,1001,1
959,tinkaton,959,7,1128,,1002,1
960,wiglett,960,12,18,,929,1
961,wugtrio,961,12,54,,930,1
962,bombirdier,962,15,429,,959,1
963,finizen,963,13,602,,933,1
964,palafin,964,13,602,,934,1
965,varoom,965,10,350,,942,1
966,revavroom,966,18,1200,,943,1
967,cyclizar,967,16,630,,953,1
968,orthworm,968,25,3100,,944,1
969,glimmet,969,7,80,,966,1
970,glimmora,970,15,450,,967,1
971,greavard,971,6,350,,924,1
972,houndstone,972,20,150,,925,1
973,flamigo,973,16,370,,961,1
974,cetoddle,974,12,450,,947,1
975,cetitan,975,45,7000,,948,1
976,veluza,976,25,900,,932,1
977,dondozo,977,120,2200,,931,1
978,tatsugiri,978,3,80,,952,1
979,annihilape,979,12,560,,1010,1
980,clodsire,980,18,2230,,1009,1
981,farigiraf,981,32,1600,,928,1
982,dudunsparce,982,36,392,,917,1
983,kingambit,983,20,1200,,1008,1
984,great-tusk,984,22,3200,,978,1
985,scream-tail,985,12,80,,982,1
986,brute-bonnet,986,12,210,,979,1
987,flutter-mane,987,14,40,,983,1
988,slither-wing,988,32,920,,984,1
989,sandy-shocks,989,23,600,,981,1
990,iron-treads,990,9,2400,,986,1
991,iron-bundle,991,6,110,,992,1
992,iron-hands,992,18,3807,,989,1
993,iron-jugulis,993,13,1110,,990,1
994,iron-moth,994,12,360,,988,1
995,iron-thorns,995,16,3030,,991,1
996,frigibax,996,5,170,,949,1
997,arctibax,997,8,300,,950,1
998,baxcalibur,998,21,2100,,951,1
999,gimmighoul,999,3,50,,976,1
1000,gholdengo,1000,12,300,,977,1
1001,wo-chien,1001,15,742,,996,1
1002,chien-pao,1002,19,1522,,995,1
1003,ting-lu,1003,27,6997,,994,1
1004,chi-yu,1004,4,49,,997,1
1005,roaring-moon,1005,20,3800,,985,1
1006,iron-valiant,1006,14,350,,993,1
1007,koraidon,1007,25,3030,,998,1
1008,miraidon,1008,35,2400,,999,1
1009,walking-wake,1009,35,2800,,1093,1
1010,iron-leaves,1010,15,1250,,1094,1
1011,dipplin,1011,4,97,,1095,1
1012,poltchageist,1012,1,11,,1096,1
1013,sinistcha,1013,2,22,,1097,1
1014,okidogi,1014,18,922,,1098,1
1015,munkidori,1015,10,122,,1099,1
1016,fezandipiti,1016,14,301,,1100,1
1017,ogerpon,1017,12,398,,1101,1
1018,archaludon,1018,20,600,,1102,1
1019,hydrapple,1019,18,930,,1103,1
1020,gouging-fire,1020,35,5900,,1104,1
1021,raging-bolt,1021,52,4800,,1105,1
1022,iron-boulder,1022,15,1625,,1106,1
1023,iron-crown,1023,16,1560,,1107,1
1024,terapagos,1024,2,65,,1108,1
1025,pecharunt,1025,3,3,,1109,1
899,wyrdeer,899,18,951,263,,1
900,kleavor,900,18,890,175,,1
901,ursaluna,901,24,2900,275,,1
902,basculegion-male,902,30,1100,265,,1
903,sneasler,903,13,430,102,,1
904,overqwil,904,25,605,179,,1
905,enamorus-incarnate,905,16,480,116,,1
906,sprigatito,906,4,41,62,906,1
907,floragato,907,9,122,144,907,1
908,meowscarada,908,15,312,265,908,1
909,fuecoco,909,4,98,62,909,1
910,crocalor,910,10,307,144,910,1
911,skeledirge,911,16,3265,265,911,1
912,quaxly,912,5,61,62,912,1
913,quaxwell,913,12,215,144,913,1
914,quaquaval,914,18,619,265,914,1
915,lechonk,915,5,102,51,915,1
916,oinkologne,916,10,1200,171,916,1
917,tarountula,917,3,40,42,918,1
918,spidops,918,10,165,141,919,1
919,nymble,919,2,10,42,920,1
920,lokix,920,10,175,158,921,1
921,pawmi,921,3,25,48,954,1
922,pawmo,922,4,65,123,955,1
923,pawmot,923,9,410,245,956,1
924,tandemaus,924,3,18,61,945,1
925,maushold,925,3,23,165,946,1
926,fidough,926,3,109,62,970,1
927,dachsbun,927,5,149,167,971,1
928,smoliv,928,3,65,52,935,1
929,dolliv,929,6,119,124,936,1
930,arboliva,930,14,482,255,937,1
931,squawkabilly,931,6,24,146,960,1
932,nacli,932,4,160,56,963,1
933,naclstack,933,6,1050,124,964,1
934,garganacl,934,23,2400,250,965,1
935,charcadet,935,6,105,51,1003,1
936,armarouge,936,15,850,263,1004,1
937,ceruledge,937,16,620,263,1005,1
938,tadbulb,938,3,4,54,940,1
939,bellibolt,939,12,1130,173,941,1
940,wattrel,940,4,36,56,957,1
941,kilowattrel,941,14,386,172,958,1
942,maschiff,942,5,160,68,972,1
943,mabosstiff,943,11,610,177,973,1
944,shroodle,944,2,7,58,968,1
945,grafaiai,945,7,272,170,969,1
946,bramblin,946,6,6,55,974,1
947,brambleghast,947,12,60,168,975,1
948,toedscool,948,9,330,67,1006,1
949,toedscruel,949,19,580,180,1007,1
950,klawf,950,13,790,158,962,1
951,capsakid,951,3,30,61,938,1
952,scovillain,952,9,150,170,939,1
953,rellor,953,2,10,54,922,1
954,rabsca,954,3,35,165,923,1
955,flittle,955,2,15,51,926,1
956,espathra,956,19,900,168,927,1
957,tinkatink,957,4,89,59,1000,1
958,tinkatuff,958,7,591,133,1001,1
959,tinkaton,959,7,1128,253,1002,1
960,wiglett,960,12,18,49,929,1
961,wugtrio,961,12,54,149,930,1
962,bombirdier,962,15,429,243,959,1
963,finizen,963,13,602,63,933,1
964,palafin,964,13,602,160,934,1
965,varoom,965,10,350,60,942,1
966,revavroom,966,18,1200,175,943,1
967,cyclizar,967,16,630,175,953,1
968,orthworm,968,25,3100,240,944,1
969,glimmet,969,7,80,70,966,1
970,glimmora,970,15,450,184,967,1
971,greavard,971,6,350,58,924,1
972,houndstone,972,20,150,171,925,1
973,flamigo,973,16,370,175,961,1
974,cetoddle,974,12,450,67,947,1
975,cetitan,975,45,7000,182,948,1
976,veluza,976,25,900,167,932,1
977,dondozo,977,120,2200,265,931,1
978,tatsugiri,978,3,80,166,952,1
979,annihilape,979,12,560,268,1010,1
980,clodsire,980,18,2230,151,1009,1
981,farigiraf,981,32,1600,260,928,1
982,dudunsparce,982,36,392,182,917,1
983,kingambit,983,20,1200,275,1008,1
984,great-tusk,984,22,3200,285,978,1
985,scream-tail,985,12,80,285,982,1
986,brute-bonnet,986,12,210,285,979,1
987,flutter-mane,987,14,40,285,983,1
988,slither-wing,988,32,920,285,984,1
989,sandy-shocks,989,23,600,285,981,1
990,iron-treads,990,9,2400,285,986,1
991,iron-bundle,991,6,110,285,992,1
992,iron-hands,992,18,3807,285,989,1
993,iron-jugulis,993,13,1110,285,990,1
994,iron-moth,994,12,360,285,988,1
995,iron-thorns,995,16,3030,285,991,1
996,frigibax,996,5,170,64,949,1
997,arctibax,997,8,300,148,950,1
998,baxcalibur,998,21,2100,300,951,1
999,gimmighoul,999,3,50,60,976,1
1000,gholdengo,1000,12,300,275,977,1
1001,wo-chien,1001,15,742,285,996,1
1002,chien-pao,1002,19,1522,285,995,1
1003,ting-lu,1003,27,6997,285,994,1
1004,chi-yu,1004,4,49,285,997,1
1005,roaring-moon,1005,20,3800,295,985,1
1006,iron-valiant,1006,14,350,295,993,1
1007,koraidon,1007,25,3030,335,998,1
1008,miraidon,1008,35,2400,335,999,1
1009,walking-wake,1009,35,2800,295,1093,1
1010,iron-leaves,1010,15,1250,295,1094,1
1011,dipplin,1011,4,97,170,1095,1
1012,poltchageist,1012,1,11,62,1096,1
1013,sinistcha,1013,2,22,178,1097,1
1014,okidogi,1014,18,922,278,1098,1
1015,munkidori,1015,10,122,278,1099,1
1016,fezandipiti,1016,14,301,278,1100,1
1017,ogerpon,1017,12,398,275,1101,1
1018,archaludon,1018,20,600,300,1102,1
1019,hydrapple,1019,18,930,270,1103,1
1020,gouging-fire,1020,35,5900,295,1104,1
1021,raging-bolt,1021,52,4800,295,1105,1
1022,iron-boulder,1022,15,1625,295,1106,1
1023,iron-crown,1023,16,1560,295,1107,1
1024,terapagos,1024,2,65,90,1108,1
1025,pecharunt,1025,3,3,300,1109,1
10001,deoxys-attack,386,17,608,270,515,0
10002,deoxys-defense,386,17,608,270,516,0
10003,deoxys-speed,386,17,608,270,517,0

1 id identifier species_id height weight base_experience order is_default
897 896 glastrier 896 22 8000 290 1088 1
898 897 spectrier 897 20 445 290 1089 1
899 898 calyrex 898 11 77 250 1090 1
900 899 wyrdeer 899 18 951 263 1
901 900 kleavor 900 18 890 175 1
902 901 ursaluna 901 24 2900 275 1
903 902 basculegion-male 902 30 1100 265 1
904 903 sneasler 903 13 430 102 1
905 904 overqwil 904 25 605 179 1
906 905 enamorus-incarnate 905 16 480 116 1
907 906 sprigatito 906 4 41 62 906 1
908 907 floragato 907 9 122 144 907 1
909 908 meowscarada 908 15 312 265 908 1
910 909 fuecoco 909 4 98 62 909 1
911 910 crocalor 910 10 307 144 910 1
912 911 skeledirge 911 16 3265 265 911 1
913 912 quaxly 912 5 61 62 912 1
914 913 quaxwell 913 12 215 144 913 1
915 914 quaquaval 914 18 619 265 914 1
916 915 lechonk 915 5 102 51 915 1
917 916 oinkologne 916 10 1200 171 916 1
918 917 tarountula 917 3 40 42 918 1
919 918 spidops 918 10 165 141 919 1
920 919 nymble 919 2 10 42 920 1
921 920 lokix 920 10 175 158 921 1
922 921 pawmi 921 3 25 48 954 1
923 922 pawmo 922 4 65 123 955 1
924 923 pawmot 923 9 410 245 956 1
925 924 tandemaus 924 3 18 61 945 1
926 925 maushold 925 3 23 165 946 1
927 926 fidough 926 3 109 62 970 1
928 927 dachsbun 927 5 149 167 971 1
929 928 smoliv 928 3 65 52 935 1
930 929 dolliv 929 6 119 124 936 1
931 930 arboliva 930 14 482 255 937 1
932 931 squawkabilly 931 6 24 146 960 1
933 932 nacli 932 4 160 56 963 1
934 933 naclstack 933 6 1050 124 964 1
935 934 garganacl 934 23 2400 250 965 1
936 935 charcadet 935 6 105 51 1003 1
937 936 armarouge 936 15 850 263 1004 1
938 937 ceruledge 937 16 620 263 1005 1
939 938 tadbulb 938 3 4 54 940 1
940 939 bellibolt 939 12 1130 173 941 1
941 940 wattrel 940 4 36 56 957 1
942 941 kilowattrel 941 14 386 172 958 1
943 942 maschiff 942 5 160 68 972 1
944 943 mabosstiff 943 11 610 177 973 1
945 944 shroodle 944 2 7 58 968 1
946 945 grafaiai 945 7 272 170 969 1
947 946 bramblin 946 6 6 55 974 1
948 947 brambleghast 947 12 60 168 975 1
949 948 toedscool 948 9 330 67 1006 1
950 949 toedscruel 949 19 580 180 1007 1
951 950 klawf 950 13 790 158 962 1
952 951 capsakid 951 3 30 61 938 1
953 952 scovillain 952 9 150 170 939 1
954 953 rellor 953 2 10 54 922 1
955 954 rabsca 954 3 35 165 923 1
956 955 flittle 955 2 15 51 926 1
957 956 espathra 956 19 900 168 927 1
958 957 tinkatink 957 4 89 59 1000 1
959 958 tinkatuff 958 7 591 133 1001 1
960 959 tinkaton 959 7 1128 253 1002 1
961 960 wiglett 960 12 18 49 929 1
962 961 wugtrio 961 12 54 149 930 1
963 962 bombirdier 962 15 429 243 959 1
964 963 finizen 963 13 602 63 933 1
965 964 palafin 964 13 602 160 934 1
966 965 varoom 965 10 350 60 942 1
967 966 revavroom 966 18 1200 175 943 1
968 967 cyclizar 967 16 630 175 953 1
969 968 orthworm 968 25 3100 240 944 1
970 969 glimmet 969 7 80 70 966 1
971 970 glimmora 970 15 450 184 967 1
972 971 greavard 971 6 350 58 924 1
973 972 houndstone 972 20 150 171 925 1
974 973 flamigo 973 16 370 175 961 1
975 974 cetoddle 974 12 450 67 947 1
976 975 cetitan 975 45 7000 182 948 1
977 976 veluza 976 25 900 167 932 1
978 977 dondozo 977 120 2200 265 931 1
979 978 tatsugiri 978 3 80 166 952 1
980 979 annihilape 979 12 560 268 1010 1
981 980 clodsire 980 18 2230 151 1009 1
982 981 farigiraf 981 32 1600 260 928 1
983 982 dudunsparce 982 36 392 182 917 1
984 983 kingambit 983 20 1200 275 1008 1
985 984 great-tusk 984 22 3200 285 978 1
986 985 scream-tail 985 12 80 285 982 1
987 986 brute-bonnet 986 12 210 285 979 1
988 987 flutter-mane 987 14 40 285 983 1
989 988 slither-wing 988 32 920 285 984 1
990 989 sandy-shocks 989 23 600 285 981 1
991 990 iron-treads 990 9 2400 285 986 1
992 991 iron-bundle 991 6 110 285 992 1
993 992 iron-hands 992 18 3807 285 989 1
994 993 iron-jugulis 993 13 1110 285 990 1
995 994 iron-moth 994 12 360 285 988 1
996 995 iron-thorns 995 16 3030 285 991 1
997 996 frigibax 996 5 170 64 949 1
998 997 arctibax 997 8 300 148 950 1
999 998 baxcalibur 998 21 2100 300 951 1
1000 999 gimmighoul 999 3 50 60 976 1
1001 1000 gholdengo 1000 12 300 275 977 1
1002 1001 wo-chien 1001 15 742 285 996 1
1003 1002 chien-pao 1002 19 1522 285 995 1
1004 1003 ting-lu 1003 27 6997 285 994 1
1005 1004 chi-yu 1004 4 49 285 997 1
1006 1005 roaring-moon 1005 20 3800 295 985 1
1007 1006 iron-valiant 1006 14 350 295 993 1
1008 1007 koraidon 1007 25 3030 335 998 1
1009 1008 miraidon 1008 35 2400 335 999 1
1010 1009 walking-wake 1009 35 2800 295 1093 1
1011 1010 iron-leaves 1010 15 1250 295 1094 1
1012 1011 dipplin 1011 4 97 170 1095 1
1013 1012 poltchageist 1012 1 11 62 1096 1
1014 1013 sinistcha 1013 2 22 178 1097 1
1015 1014 okidogi 1014 18 922 278 1098 1
1016 1015 munkidori 1015 10 122 278 1099 1
1017 1016 fezandipiti 1016 14 301 278 1100 1
1018 1017 ogerpon 1017 12 398 275 1101 1
1019 1018 archaludon 1018 20 600 300 1102 1
1020 1019 hydrapple 1019 18 930 270 1103 1
1021 1020 gouging-fire 1020 35 5900 295 1104 1
1022 1021 raging-bolt 1021 52 4800 295 1105 1
1023 1022 iron-boulder 1022 15 1625 295 1106 1
1024 1023 iron-crown 1023 16 1560 295 1107 1
1025 1024 terapagos 1024 2 65 90 1108 1
1026 1025 pecharunt 1025 3 3 300 1109 1
1027 10001 deoxys-attack 386 17 608 270 515 0
1028 10002 deoxys-defense 386 17 608 270 516 0
1029 10003 deoxys-speed 386 17 608 270 517 0

View file

@ -183572,3 +183572,37 @@ gives rise to the budding of fresh life across Hisui."
1007,41,9,"This Pokémon resembles Cyclizar, but it is far burlier and more ferocious. Nothing is known about its ecology or other features."
1008,40,9,"Much remains unknown about this creature. It resembles Cyclizar, but it is far more ruthless and powerful."
1008,41,9,"This seems to be the Iron Serpent mentioned in an old book. The Iron Serpent is said to have turned the land to ash with its lightning."
1009,40,9,"This ferocious creature is shrouded in mystery. It's named after an aquatic monster mentioned in an old expedition journal."
1009,41,9,"It resembles an illustration published in a paranormal magazine, said to be a depiction of a super-ancient Suicune."
1010,40,9,"Many of its physical characteristics match those of a Virizion from the future that was covered in a paranormal magazine."
1010,41,9,"According to the few eyewitness accounts that exist, it used its shining blades to julienne large trees and boulders."
1011,40,9,"Dipplin is two creatures in one Pokémon. Its evolution was triggered by a special apple grown only in one place."
1011,41,9,"The head sticking out belongs to the fore-wyrm, while the tail belongs to the core-wyrm. The two share one apple and help each other out."
1012,40,9,"Supposedly, the regrets of a tea ceremony master who died before perfecting his craft lingered in some matcha and became a Pokémon."
1012,41,9,"Poltchageist looks like a regional form of Sinistea, but it was recently discovered that the two Pokémon are entirely unrelated."
1013,40,9,"It pretends to be tea, trying to fool people into drinking it so it can drain their life-force. Its ruse is generally unsuccessful."
1013,41,9,"It prefers cool, dark places, such as the back of a shelf or the space beneath a home's floorboards. It wanders in search of prey after sunset."
1014,40,9,"After all its muscles were stimulated by the toxic chain around its neck, Okidogi transformed and gained a powerful physique."
1014,41,9,"Okidogi is a ruffian with a short temper. It can pulverize anything by swinging around the chain on its neck."
1015,40,9,"The chain is made from toxins that enhance capabilities. It stimulated Munkidori's brain and caused the Pokémon's psychic powers to bloom."
1015,41,9,"Munkidori keeps itself somewhere safe while it toys with its foes, using psychokinesis to induce intense dizziness."
1016,40,9,"Fezandipiti owes its beautiful looks and lovely voice to the toxic stimulants emanating from the chain wrapped around its body."
1016,41,9,"Fezandipiti beats its glossy wings to scatter pheromones that captivate people and Pokémon."
1017,40,9,"This Pokémon's type changes based on which mask it's wearing. It confounds its enemies with nimble movements and kicks."
1017,41,9,"This mischief-loving Pokémon is full of curiosity. It battles by drawing out the type-based energy contained within its masks."
1018,40,9,"It gathers static electricity from its surroundings. The beams it launches when down on all fours are tremendously powerful."
1018,41,9,"It digs holes on mountains, searching for food. Its so durable that being caught in a cave-in wont faze it."
1019,40,9,"Seven syrpents live inside an apple made of syrup. The syrpent in the center is the commander."
1019,41,9,"These capricious syrpents have banded together. On the rare occasion that their moods align, their true power is unleashed."
1020,40,9,"There are scant few reports of this creature being sighted. One short video shows it rampaging and spouting pillars of flame."
1020,41,9,"It resembles an eerie Pokémon once shown in a paranormal magazine. That Pokémon was said to be an Entei regenerated from a fossil."
1021,40,9,"It's said to incinerate everything around it with lightning launched from its fur. Very little is known about this creature."
1021,41,9,"It bears resemblance to a Pokémon that became a hot topic for a short while after a paranormal magazine touted it as Raikou's ancestor."
1022,40,9,"It resembles a Pokémon described in a dubious magazine as a Terrakion that had been modified by an evil organization."
1022,41,9,"It was named after a mysterious object recorded in an old book. Its body seems to be metallic."
1023,40,9,"It resembles a mysterious object introduced in a paranormal magazine as a cutting-edge weapon shaped like a Cobalion."
1023,41,9,"There was supposedly an incident in which it launched shining blades to cut everything around it to pieces. Little else is known about it."
1024,40,9,"Terapagos protects itself using its power to transform energy into hard crystals. This Pokémon is the source of the Terastal phenomenon."
1024,41,9,"Its thought that this Pokémon lived in ancient Paldea until it got caught in seismic shifts and went extinct."
1025,40,9,"It feeds others toxic mochi that draw out desires and capabilities. Those who eat the mochi fall under Pecharunts control, chained to its will."
1025,41,9,"Its peach-shaped shell serves as storage for a potent poison. It makes poisonous mochi and serves them to people and Pokémon."

Can't render this file because it is too large.

View file

@ -11116,7 +11116,7 @@ pokemon_species_id,local_language_id,name,genus
1011,6,Sirapfel,
1011,7,Dipplin,
1011,8,Dipplin,
1011,9,Dipplin,
1011,9,Dipplin,Candy Apple Pokémon
1011,11,カミッチュ,
1011,12,裹蜜虫,
1012,1,チャデス,
@ -11126,7 +11126,7 @@ pokemon_species_id,local_language_id,name,genus
1012,6,Mortcha,
1012,7,Poltchageist,
1012,8,Poltchageist,
1012,9,Poltchageist,
1012,9,Poltchageist,Matcha Pokémon
1012,11,チャデス,
1012,12,斯魔茶,
1013,1,ヤバソチャ,
@ -11136,7 +11136,7 @@ pokemon_species_id,local_language_id,name,genus
1013,6,Fatalitcha,
1013,7,Sinistcha,
1013,8,Sinistcha,
1013,9,Sinistcha,
1013,9,Sinistcha,Matcha Pokémon
1013,11,ヤバソチャ,
1013,12,来悲粗茶,
1014,1,イイネイヌ,
@ -11146,7 +11146,7 @@ pokemon_species_id,local_language_id,name,genus
1014,6,Boninu,
1014,7,Okidogi,
1014,8,Okidogi,
1014,9,Okidogi,
1014,9,Okidogi,Retainer Pokémon
1014,11,イイネイヌ,
1014,12,够赞狗,
1015,1,マシマシラ,
@ -11156,7 +11156,7 @@ pokemon_species_id,local_language_id,name,genus
1015,6,Benesaru,
1015,7,Munkidori,
1015,8,Munkidori,
1015,9,Munkidori,
1015,9,Munkidori,Retainer Pokémon
1015,11,マシマシラ,
1015,12,愿增猿,
1016,1,キチキギス,
@ -11166,7 +11166,7 @@ pokemon_species_id,local_language_id,name,genus
1016,6,Beatori,
1016,7,Fezandipiti,
1016,8,Fezandipiti,
1016,9,Fezandipiti,
1016,9,Fezandipiti,Retainer Pokémon
1016,11,キチキギス,
1016,12,吉雉鸡,
1017,1,オーガポン,
@ -11176,7 +11176,7 @@ pokemon_species_id,local_language_id,name,genus
1017,6,Ogerpon,
1017,7,Ogerpon,
1017,8,Ogerpon,
1017,9,Ogerpon,
1017,9,Ogerpon,Mask Pokémon
1017,11,オーガポン,
1017,12,厄诡椪,
1018,1,ブリジュラス,ごうきんポケモン
@ -11206,7 +11206,7 @@ pokemon_species_id,local_language_id,name,genus
1020,6,Keilflamme,
1020,7,Flamariete,
1020,8,Vampeaguzze,
1020,9,Gouging Fire,Paladox Pokémon
1020,9,Gouging Fire,Paradox Pokémon
1020,11,ウガツホムラ,パラドックスポケモン
1020,12,破空焰,
1021,1,タケルライコ,パラドックスポケモン
@ -11216,7 +11216,7 @@ pokemon_species_id,local_language_id,name,genus
1021,6,Furienblitz,
1021,7,Electrofuria,
1021,8,Furiatonante,
1021,9,Raging Bolt,Paladox Pokémon
1021,9,Raging Bolt,Paradox Pokémon
1021,11,タケルライコ,パラドックスポケモン
1021,12,猛雷鼓,
1022,1,テツノイワオ,パラドックスポケモン
@ -11226,7 +11226,7 @@ pokemon_species_id,local_language_id,name,genus
1022,6,Eisenfels,
1022,7,Ferromole,
1022,8,Massoferreo,
1022,9,Iron Boulder,Paladox Pokémon
1022,9,Iron Boulder,Paradox Pokémon
1022,11,テツノイワオ,パラドックスポケモン
1022,12,鐵磐岩,
1023,1,テツノカシラ,パラドックスポケモン
@ -11236,7 +11236,7 @@ pokemon_species_id,local_language_id,name,genus
1023,6,Eisenhaupt,
1023,7,Ferrotesta,
1023,8,Capoferreo,
1023,9,Iron Crown,Paladox Pokémon
1023,9,Iron Crown,Paradox Pokémon
1023,11,テツノカシラ,パラドックスポケモン
1023,12,鐵頭殼,
1024,1,テラパゴス,テラスタルポケモン

1 pokemon_species_id local_language_id name genus
11116 1011 6 Sirapfel
11117 1011 7 Dipplin
11118 1011 8 Dipplin
11119 1011 9 Dipplin Candy Apple Pokémon
11120 1011 11 カミッチュ
11121 1011 12 裹蜜虫
11122 1012 1 チャデス
11126 1012 6 Mortcha
11127 1012 7 Poltchageist
11128 1012 8 Poltchageist
11129 1012 9 Poltchageist Matcha Pokémon
11130 1012 11 チャデス
11131 1012 12 斯魔茶
11132 1013 1 ヤバソチャ
11136 1013 6 Fatalitcha
11137 1013 7 Sinistcha
11138 1013 8 Sinistcha
11139 1013 9 Sinistcha Matcha Pokémon
11140 1013 11 ヤバソチャ
11141 1013 12 来悲粗茶
11142 1014 1 イイネイヌ
11146 1014 6 Boninu
11147 1014 7 Okidogi
11148 1014 8 Okidogi
11149 1014 9 Okidogi Retainer Pokémon
11150 1014 11 イイネイヌ
11151 1014 12 够赞狗
11152 1015 1 マシマシラ
11156 1015 6 Benesaru
11157 1015 7 Munkidori
11158 1015 8 Munkidori
11159 1015 9 Munkidori Retainer Pokémon
11160 1015 11 マシマシラ
11161 1015 12 愿增猿
11162 1016 1 キチキギス
11166 1016 6 Beatori
11167 1016 7 Fezandipiti
11168 1016 8 Fezandipiti
11169 1016 9 Fezandipiti Retainer Pokémon
11170 1016 11 キチキギス
11171 1016 12 吉雉鸡
11172 1017 1 オーガポン
11176 1017 6 Ogerpon
11177 1017 7 Ogerpon
11178 1017 8 Ogerpon
11179 1017 9 Ogerpon Mask Pokémon
11180 1017 11 オーガポン
11181 1017 12 厄诡椪
11182 1018 1 ブリジュラス ごうきんポケモン
11206 1020 6 Keilflamme
11207 1020 7 Flamariete
11208 1020 8 Vampeaguzze
11209 1020 9 Gouging Fire Paladox Pokémon Paradox Pokémon
11210 1020 11 ウガツホムラ パラドックスポケモン
11211 1020 12 破空焰
11212 1021 1 タケルライコ パラドックスポケモン
11216 1021 6 Furienblitz
11217 1021 7 Electrofuria
11218 1021 8 Furiatonante
11219 1021 9 Raging Bolt Paladox Pokémon Paradox Pokémon
11220 1021 11 タケルライコ パラドックスポケモン
11221 1021 12 猛雷鼓
11222 1022 1 テツノイワオ パラドックスポケモン
11226 1022 6 Eisenfels
11227 1022 7 Ferromole
11228 1022 8 Massoferreo
11229 1022 9 Iron Boulder Paladox Pokémon Paradox Pokémon
11230 1022 11 テツノイワオ パラドックスポケモン
11231 1022 12 鐵磐岩
11232 1023 1 テツノカシラ パラドックスポケモン
11236 1023 6 Eisenhaupt
11237 1023 7 Ferrotesta
11238 1023 8 Capoferreo
11239 1023 9 Iron Crown Paladox Pokémon Paradox Pokémon
11240 1023 11 テツノカシラ パラドックスポケモン
11241 1023 12 鐵頭殼
11242 1024 1 テラパゴス テラスタルポケモン

View file

@ -179,6 +179,16 @@ type_id,local_language_id,name
18,9,Fairy
18,11,フェアリー
18,12,妖精
19,1,ステラ
19,2, Stella
19,3, 스텔라
19,4,星晶
19,5,Stellaire
19,6,Stellar
19,7,Astral
19,8,Astrale
19,9,Stellar
19,11,ステラ
10001,1,
10001,3,???
10001,4,???

1 type_id local_language_id name
179 18 9 Fairy
180 18 11 フェアリー
181 18 12 妖精
182 19 1 ステラ
183 19 2 Stella
184 19 3 스텔라
185 19 4 星晶
186 19 5 Stellaire
187 19 6 Stellar
188 19 7 Astral
189 19 8 Astrale
190 19 9 Stellar
191 19 11 ステラ
192 10001 1 ???
193 10001 3 ???
194 10001 4 ???

View file

@ -17,5 +17,6 @@ id,identifier,generation_id,damage_class_id
16,dragon,1,3
17,dark,2,3
18,fairy,6,
19,stellar,9,
10001,unknown,2,
10002,shadow,3,

1 id identifier generation_id damage_class_id
17 16 dragon 1 3
18 17 dark 2 3
19 18 fairy 6
20 19 stellar 9
21 10001 unknown 2
22 10002 shadow 3

42
default.nix Normal file
View file

@ -0,0 +1,42 @@
with import <nixpkgs> { };
let
pythonPackages = python3Packages;
in pkgs.mkShell rec {
name = "impurePythonEnv";
venvDir = "./.venv";
buildInputs = [
python310Packages.python
python310Packages.venvShellHook
# python310Packages.coverage
# python310Packages.python-mimeparse
# python310Packages.python-dateutil
# python310Packages.drf-spectacular
# python310Packages.djangorestframework
# python310Packages.django-redis
# python310Packages.django-cors-headers
# Required dependancies
black
taglib
openssl
git
libxml2
libxslt
libzip
zlib
];
# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
'';
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
}

9157
openapi.yml Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,9 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from django.shortcuts import get_object_or_404
from django.http import Http404
from django.db.models import Q
from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiParameter
from drf_spectacular.types import OpenApiTypes
from .models import *
from .serializers import *
@ -38,6 +41,25 @@ class NameOrIdRetrieval:
idPattern = re.compile(r"^-?[0-9]+$")
namePattern = re.compile(r"^[0-9A-Za-z\-\+]+$")
def get_queryset(self):
queryset = super().get_queryset()
filter = self.request.GET.get("q", "")
if filter:
queryset = queryset.filter(Q(name__icontains=filter))
return queryset
@extend_schema(
parameters=[
OpenApiParameter(
name="id",
description="This parameter can be a string or an integer.",
location=OpenApiParameter.PATH,
type=OpenApiTypes.STR,
),
]
)
def get_object(self):
queryset = self.get_queryset()
queryset = self.filter_queryset(queryset)
@ -70,299 +92,879 @@ class PokeapiCommonViewset(
##########
@extend_schema(
description="Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.",
tags=["pokemon"],
)
class AbilityResource(PokeapiCommonViewset):
queryset = Ability.objects.all()
serializer_class = AbilityDetailSerializer
list_serializer_class = AbilitySummarySerializer
@extend_schema(
description="Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail.",
tags=["berries"],
summary="Get a berry",
)
@extend_schema_view(
list=extend_schema(
summary="List berries",
)
)
class BerryResource(PokeapiCommonViewset):
queryset = Berry.objects.all()
serializer_class = BerryDetailSerializer
list_serializer_class = BerrySummarySerializer
@extend_schema(
description="Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.",
tags=["berries"],
summary="Get berry by firmness",
)
@extend_schema_view(
list=extend_schema(
summary="List berry firmness",
)
)
class BerryFirmnessResource(PokeapiCommonViewset):
queryset = BerryFirmness.objects.all()
serializer_class = BerryFirmnessDetailSerializer
list_serializer_class = BerryFirmnessSummarySerializer
@extend_schema(
description="Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail.",
summary="Get berries by flavor",
tags=["berries"],
)
@extend_schema_view(
list=extend_schema(
summary="List berry flavors",
)
)
class BerryFlavorResource(PokeapiCommonViewset):
queryset = BerryFlavor.objects.all()
serializer_class = BerryFlavorDetailSerializer
list_serializer_class = BerryFlavorSummarySerializer
@extend_schema(
description="Characteristics indicate which stat contains a Pokémon's highest IV. A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.",
summary="Get characteristic",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List charecterictics",
)
)
class CharacteristicResource(PokeapiCommonViewset):
queryset = Characteristic.objects.all()
serializer_class = CharacteristicDetailSerializer
list_serializer_class = CharacteristicSummarySerializer
@extend_schema(
description="Contest effects refer to the effects of moves when used in contests.",
tags=["contests"],
summary="Get contest effect",
)
@extend_schema_view(
list=extend_schema(
summary="List contest effects",
)
)
class ContestEffectResource(PokeapiCommonViewset):
queryset = ContestEffect.objects.all()
serializer_class = ContestEffectDetailSerializer
list_serializer_class = ContestEffectSummarySerializer
@extend_schema(
description="Contest types are categories judges used to weigh a Pokémon's condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.",
summary="Get contest type",
tags=["contests"],
)
@extend_schema_view(
list=extend_schema(
summary="List contest types",
)
)
class ContestTypeResource(PokeapiCommonViewset):
queryset = ContestType.objects.all()
serializer_class = ContestTypeDetailSerializer
list_serializer_class = ContestTypeSummarySerializer
@extend_schema(
description="Egg Groups are categories which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.",
summary="Get egg group",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List egg groups",
)
)
class EggGroupResource(PokeapiCommonViewset):
queryset = EggGroup.objects.all()
serializer_class = EggGroupDetailSerializer
list_serializer_class = EggGroupSummarySerializer
@extend_schema(
description="Conditions which affect what pokemon might appear in the wild, e.g., day or night.",
summary="Get encounter condition",
tags=["encounters"],
)
@extend_schema_view(
list=extend_schema(
summary="List encounter conditions",
)
)
class EncounterConditionResource(PokeapiCommonViewset):
queryset = EncounterCondition.objects.all()
serializer_class = EncounterConditionDetailSerializer
list_serializer_class = EncounterConditionSummarySerializer
@extend_schema(
description="Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night.",
summary="Get encounter condition value",
tags=["encounters"],
)
@extend_schema_view(
list=extend_schema(
summary="List encounter condition values",
)
)
class EncounterConditionValueResource(PokeapiCommonViewset):
queryset = EncounterConditionValue.objects.all()
serializer_class = EncounterConditionValueDetailSerializer
list_serializer_class = EncounterConditionValueSummarySerializer
@extend_schema(
description="Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail.",
summary="Get encounter method",
tags=["encounters"],
)
@extend_schema_view(
list=extend_schema(
summary="List encounter methods",
)
)
class EncounterMethodResource(PokeapiCommonViewset):
queryset = EncounterMethod.objects.all()
serializer_class = EncounterMethodDetailSerializer
list_serializer_class = EncounterMethodSummarySerializer
@extend_schema(
description="Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.",
summary="Get evolution chain",
tags=["evolution"],
)
@extend_schema_view(
list=extend_schema(
summary="List evolution chains",
)
)
class EvolutionChainResource(PokeapiCommonViewset):
queryset = EvolutionChain.objects.all()
serializer_class = EvolutionChainDetailSerializer
list_serializer_class = EvolutionChainSummarySerializer
@extend_schema(
description="Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.",
summary="Get evolution trigger",
tags=["evolution"],
)
@extend_schema_view(
list=extend_schema(
summary="List evolution triggers",
)
)
class EvolutionTriggerResource(PokeapiCommonViewset):
queryset = EvolutionTrigger.objects.all()
serializer_class = EvolutionTriggerDetailSerializer
list_serializer_class = EvolutionTriggerSummarySerializer
@extend_schema(
description="A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.",
summary="Get genration",
tags=["games"],
)
@extend_schema_view(
list=extend_schema(
summary="List genrations",
)
)
class GenerationResource(PokeapiCommonViewset):
queryset = Generation.objects.all()
serializer_class = GenerationDetailSerializer
list_serializer_class = GenerationSummarySerializer
@extend_schema(
description="Genders were introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.",
summary="Get gender",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List genders",
)
)
class GenderResource(PokeapiCommonViewset):
queryset = Gender.objects.all()
serializer_class = GenderDetailSerializer
list_serializer_class = GenderSummarySerializer
@extend_schema(
description="Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.",
summary="Get growth rate",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List growth rates",
)
)
class GrowthRateResource(PokeapiCommonViewset):
queryset = GrowthRate.objects.all()
serializer_class = GrowthRateDetailSerializer
list_serializer_class = GrowthRateSummarySerializer
@extend_schema(
description="An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.",
summary="Get item",
tags=["items"],
)
@extend_schema_view(
list=extend_schema(
summary="List items",
)
)
class ItemResource(PokeapiCommonViewset):
queryset = Item.objects.all()
serializer_class = ItemDetailSerializer
list_serializer_class = ItemSummarySerializer
@extend_schema(
description="Item categories determine where items will be placed in the players bag.",
summary="Get item category",
tags=["items"],
)
@extend_schema_view(
list=extend_schema(
summary="List item categories",
)
)
class ItemCategoryResource(PokeapiCommonViewset):
queryset = ItemCategory.objects.all()
serializer_class = ItemCategoryDetailSerializer
list_serializer_class = ItemCategorySummarySerializer
@extend_schema(
description='Item attributes define particular aspects of items, e.g."usable in battle" or "consumable".',
summary="Get item attribute",
tags=["items"],
)
@extend_schema_view(
list=extend_schema(
summary="List item attributes",
)
)
class ItemAttributeResource(PokeapiCommonViewset):
queryset = ItemAttribute.objects.all()
serializer_class = ItemAttributeDetailSerializer
list_serializer_class = ItemAttributeSummarySerializer
@extend_schema(
description='The various effects of the move"Fling" when used with different items.',
summary="Get item fling effect",
tags=["items"],
)
@extend_schema_view(
list=extend_schema(
summary="List item fling effects",
)
)
class ItemFlingEffectResource(PokeapiCommonViewset):
queryset = ItemFlingEffect.objects.all()
serializer_class = ItemFlingEffectDetailSerializer
list_serializer_class = ItemFlingEffectSummarySerializer
@extend_schema(
description="Pockets within the players bag used for storing items by category.",
summary="Get item pocket",
tags=["items"],
)
@extend_schema_view(
list=extend_schema(
summary="List item pockets",
)
)
class ItemPocketResource(PokeapiCommonViewset):
queryset = ItemPocket.objects.all()
serializer_class = ItemPocketDetailSerializer
list_serializer_class = ItemPocketSummarySerializer
@extend_schema(
description="Languages for translations of API resource information.",
summary="Get language",
tags=["utility"],
)
@extend_schema_view(
list=extend_schema(
summary="List languages",
)
)
class LanguageResource(PokeapiCommonViewset):
queryset = Language.objects.all()
serializer_class = LanguageDetailSerializer
list_serializer_class = LanguageSummarySerializer
@extend_schema(
description="Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.",
summary="Get location",
tags=["location"],
)
@extend_schema_view(
list=extend_schema(
summary="List locations",
)
)
class LocationResource(PokeapiCommonViewset):
queryset = Location.objects.all()
serializer_class = LocationDetailSerializer
list_serializer_class = LocationSummarySerializer
@extend_schema(
description="Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.",
summary="Get location area",
tags=["location"],
)
@extend_schema_view(
list=extend_schema(
summary="List location areas",
)
)
class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelViewSet):
queryset = LocationArea.objects.all()
serializer_class = LocationAreaDetailSerializer
list_serializer_class = LocationAreaSummarySerializer
@extend_schema(
description="Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.",
summary="Get machine",
tags=["machines"],
)
@extend_schema_view(
list=extend_schema(
summary="List machines",
)
)
class MachineResource(PokeapiCommonViewset):
queryset = Machine.objects.all()
serializer_class = MachineDetailSerializer
list_serializer_class = MachineSummarySerializer
@extend_schema(
description="Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.",
summary="Get move",
tags=["moves"],
)
@extend_schema_view(
list=extend_schema(
summary="List moves",
)
)
class MoveResource(PokeapiCommonViewset):
queryset = Move.objects.all()
serializer_class = MoveDetailSerializer
list_serializer_class = MoveSummarySerializer
@extend_schema(
description="Damage classes moves can have, e.g. physical, special, or non-damaging.",
summary="Get move damage class",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List move damage classes",
)
)
class MoveDamageClassResource(PokeapiCommonViewset):
queryset = MoveDamageClass.objects.all()
serializer_class = MoveDamageClassDetailSerializer
list_serializer_class = MoveDamageClassSummarySerializer
@extend_schema(
description="Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.",
summary="Get move meta ailment",
tags=["moves"],
)
@extend_schema_view(
list=extend_schema(
summary="List move meta ailments",
)
)
class MoveMetaAilmentResource(PokeapiCommonViewset):
queryset = MoveMetaAilment.objects.all()
serializer_class = MoveMetaAilmentDetailSerializer
list_serializer_class = MoveMetaAilmentSummarySerializer
@extend_schema(
description="Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.",
summary="Get move battle style",
tags=["moves"],
)
@extend_schema_view(
list=extend_schema(
summary="List move battle styles",
)
)
class MoveBattleStyleResource(PokeapiCommonViewset):
queryset = MoveBattleStyle.objects.all()
serializer_class = MoveBattleStyleDetailSerializer
list_serializer_class = MoveBattleStyleSummarySerializer
@extend_schema(
description="Very general categories that loosely group move effects.",
summary="Get move meta category",
tags=["moves"],
)
@extend_schema_view(
list=extend_schema(
summary="List move meta categories",
)
)
class MoveMetaCategoryResource(PokeapiCommonViewset):
queryset = MoveMetaCategory.objects.all()
serializer_class = MoveMetaCategoryDetailSerializer
list_serializer_class = MoveMetaCategorySummarySerializer
@extend_schema(
description="Methods by which Pokémon can learn moves.",
summary="Get move learn method",
tags=["moves"],
)
@extend_schema_view(
list=extend_schema(
summary="List move learn methods",
)
)
class MoveLearnMethodResource(PokeapiCommonViewset):
queryset = MoveLearnMethod.objects.all()
serializer_class = MoveLearnMethodDetailSerializer
list_serializer_class = MoveLearnMethodSummarySerializer
@extend_schema(
description="Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.",
summary="Get move target",
tags=["moves"],
)
@extend_schema_view(
list=extend_schema(
summary="List move targets",
)
)
class MoveTargetResource(PokeapiCommonViewset):
queryset = MoveTarget.objects.all()
serializer_class = MoveTargetDetailSerializer
list_serializer_class = MoveTargetSummarySerializer
@extend_schema(
description="Natures influence how a Pokémon's stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.",
summary="Get nature",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List natures",
)
)
class NatureResource(PokeapiCommonViewset):
queryset = Nature.objects.all()
serializer_class = NatureDetailSerializer
list_serializer_class = NatureSummarySerializer
@extend_schema(
description="Areas used for grouping Pokémon encounters in Pal Park. They're like habitats that are specific to Pal Park.",
summary="Get pal park area",
tags=["location"],
)
@extend_schema_view(
list=extend_schema(
summary="List pal park areas",
)
)
class PalParkAreaResource(PokeapiCommonViewset):
queryset = PalParkArea.objects.all()
serializer_class = PalParkAreaDetailSerializer
list_serializer_class = PalParkAreaSummarySerializer
@extend_schema(
description="Pokeathlon Stats are different attributes of a Pokémon's performance in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.",
summary="Get pokeathlon stat",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokeathlon stats",
)
)
class PokeathlonStatResource(PokeapiCommonViewset):
queryset = PokeathlonStat.objects.all()
serializer_class = PokeathlonStatDetailSerializer
list_serializer_class = PokeathlonStatSummarySerializer
@extend_schema(
description="A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail.",
summary="Get pokedex",
tags=["games"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokedex",
)
)
class PokedexResource(PokeapiCommonViewset):
queryset = Pokedex.objects.all()
serializer_class = PokedexDetailSerializer
list_serializer_class = PokedexSummarySerializer
@extend_schema(
description="Colors used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon's body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.",
summary="Get pokemon color",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokemon colors",
)
)
class PokemonColorResource(PokeapiCommonViewset):
queryset = PokemonColor.objects.all()
serializer_class = PokemonColorDetailSerializer
list_serializer_class = PokemonColorSummarySerializer
@extend_schema(
description="Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the 'Pokémon' entity is used to represent such a variety.",
summary="Get pokemon form",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokemon forms",
)
)
class PokemonFormResource(PokeapiCommonViewset):
queryset = PokemonForm.objects.all()
serializer_class = PokemonFormDetailSerializer
list_serializer_class = PokemonFormSummarySerializer
@extend_schema(
description="Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.",
summary="Get pokemom habita",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokemom habitas",
)
)
class PokemonHabitatResource(PokeapiCommonViewset):
queryset = PokemonHabitat.objects.all()
serializer_class = PokemonHabitatDetailSerializer
list_serializer_class = PokemonHabitatSummarySerializer
@extend_schema(
description="Shapes used for sorting Pokémon in a Pokédex.",
summary="Get pokemon shape",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokemon shapes",
)
)
class PokemonShapeResource(PokeapiCommonViewset):
queryset = PokemonShape.objects.all()
serializer_class = PokemonShapeDetailSerializer
list_serializer_class = PokemonShapeSummarySerializer
@extend_schema(
description="Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.",
summary="Get pokemon",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokemon",
)
)
class PokemonResource(PokeapiCommonViewset):
queryset = Pokemon.objects.all()
serializer_class = PokemonDetailSerializer
list_serializer_class = PokemonSummarySerializer
@extend_schema(
description="A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.",
summary="Get pokemon species",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List pokemon species",
)
)
class PokemonSpeciesResource(PokeapiCommonViewset):
queryset = PokemonSpecies.objects.all().order_by("id")
serializer_class = PokemonSpeciesDetailSerializer
list_serializer_class = PokemonSpeciesSummarySerializer
@extend_schema(
description="A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them.",
summary="Get region",
tags=["location"],
)
@extend_schema_view(
list=extend_schema(
summary="List regions",
)
)
class RegionResource(PokeapiCommonViewset):
queryset = Region.objects.all()
serializer_class = RegionDetailSerializer
list_serializer_class = RegionSummarySerializer
@extend_schema(
description="Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.",
summary="Get stat",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List stats",
)
)
class StatResource(PokeapiCommonViewset):
queryset = Stat.objects.all()
serializer_class = StatDetailSerializer
list_serializer_class = StatSummarySerializer
@extend_schema(
description="Super contest effects refer to the effects of moves when used in super contests.",
summary="Get super contest effect",
tags=["contests"],
)
@extend_schema_view(
list=extend_schema(
summary="List super contest effects",
)
)
class SuperContestEffectResource(PokeapiCommonViewset):
queryset = SuperContestEffect.objects.all()
serializer_class = SuperContestEffectDetailSerializer
list_serializer_class = SuperContestEffectSummarySerializer
@extend_schema(
description="Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.",
summary="Get types",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(
summary="List types",
)
)
class TypeResource(PokeapiCommonViewset):
queryset = Type.objects.all()
serializer_class = TypeDetailSerializer
list_serializer_class = TypeSummarySerializer
@extend_schema(
description="Versions of the games, e.g., Red, Blue or Yellow.",
summary="Get version",
tags=["games"],
)
@extend_schema_view(
list=extend_schema(
summary="List versions",
)
)
class VersionResource(PokeapiCommonViewset):
queryset = Version.objects.all()
serializer_class = VersionDetailSerializer
list_serializer_class = VersionSummarySerializer
@extend_schema(
description="Version groups categorize highly similar versions of the games.",
summary="Get version group",
tags=["games"],
)
@extend_schema_view(
list=extend_schema(
summary="List version groups",
)
)
class VersionGroupResource(PokeapiCommonViewset):
queryset = VersionGroup.objects.all()
serializer_class = VersionGroupDetailSerializer
list_serializer_class = VersionGroupSummarySerializer
@extend_schema(
description="Handles Pokemon Encounters as a sub-resource.",
summary="Get pokemon encounter",
tags=["encounters"],
responses={
"200": {
"type": "array",
"items": {
"type": "object",
"required": ["location_area", "version_details"],
"properties": {
"location_area": {
"type": "object",
"required": ["name", "url"],
"properties": {
"name": {"type": "string", "example": "cerulean-city-area"},
"url": {
"type": "string",
"format": "uri",
"example": "https://pokeapi.co/api/v2/location-area/281/",
},
},
},
"version_details": {
"type": "array",
"items": {
"type": "object",
"required": ["encounter_details", "max_chance", "version"],
"properties": {
"encounter_details": {
"type": "array",
"items": {
"type": "object",
"required": [
"chance",
"condition_values",
"max_level",
"method",
"min_level",
],
"properties": {
"chance": {
"type": "number",
"example": 100,
},
"condition_values": {
"type": "array",
"items": {
"type": "object",
"required": ["name", "url"],
"properties": {
"name": {
"type": "string",
"example": "story-progress-beat-red",
},
"url": {
"type": "string",
"format": "uri",
"example": "https://pokeapi.co/api/v2/encounter-condition-value/55/",
},
},
},
},
"max_level": {
"type": "number",
"example": 10,
},
"method": {
"type": "object",
"required": ["name", "url"],
"properties": {
"name": {
"type": "string",
"example": "gift",
},
"url": {
"type": "string",
"format": "uri",
"example": "https://pokeapi.co/api/v2/encounter-method/18/",
},
},
},
"min_level": {
"type": "number",
"example": 10,
},
},
},
},
"max_chance": {"type": "number", "example": 100},
"version": {
"type": "object",
"required": ["name", "url"],
"properties": {
"name": {"type": "string", "example": "red"},
"url": {
"type": "string",
"format": "uri",
"example": "https://pokeapi.co/api/v2/version/1/",
},
},
},
},
},
},
},
},
}
},
)
class PokemonEncounterView(APIView):
"""
Handles Pokemon Encounters as a sub-resource.
"""
def get(self, request, pokemon_id):
self.context = dict(request=request)

File diff suppressed because it is too large Load diff

View file

@ -1679,42 +1679,46 @@ class APIData:
showdown = {
"front_default": showdown_path % pokemon.id if front_default else None,
"front_female": showdown_path % f"female/{pokemon.id}"
if front_female
else None,
"front_shiny": showdown_path % f"shiny/{pokemon.id}"
if front_shiny
else None,
"front_shiny_female": showdown_path % f"shiny/female/{pokemon.id}"
if front_shiny_female
else None,
"back_default": showdown_path % f"back/{pokemon.id}"
if back_default
else None,
"back_female": showdown_path % f"back/female/{pokemon.id}"
if back_female
else None,
"back_shiny": showdown_path % f"back/shiny/{pokemon.id}"
if back_shiny
else None,
"back_shiny_female": showdown_path % f"back/shiny/female/{pokemon.id}"
if back_shiny_female
else None,
"front_female": (
showdown_path % f"female/{pokemon.id}" if front_female else None
),
"front_shiny": (
showdown_path % f"shiny/{pokemon.id}" if front_shiny else None
),
"front_shiny_female": (
showdown_path % f"shiny/female/{pokemon.id}"
if front_shiny_female
else None
),
"back_default": (
showdown_path % f"back/{pokemon.id}" if back_default else None
),
"back_female": (
showdown_path % f"back/female/{pokemon.id}" if back_female else None
),
"back_shiny": (
showdown_path % f"back/shiny/{pokemon.id}" if back_shiny else None
),
"back_shiny_female": (
showdown_path % f"back/shiny/female/{pokemon.id}"
if back_shiny_female
else None
),
}
sprites = {
"front_default": sprite_path % pokemon.id if front_default else None,
"front_female": sprite_path % pokemon.id if front_female else None,
"front_shiny": sprite_path % pokemon.id if front_shiny else None,
"front_shiny_female": sprite_path % pokemon.id
if front_shiny_female
else None,
"front_shiny_female": (
sprite_path % pokemon.id if front_shiny_female else None
),
"back_default": sprite_path % pokemon.id if back_default else None,
"back_female": sprite_path % pokemon.id if back_female else None,
"back_shiny": sprite_path % pokemon.id if back_shiny else None,
"back_shiny_female": sprite_path % pokemon.id
if back_shiny_female
else None,
"back_shiny_female": (
sprite_path % pokemon.id if back_shiny_female else None
),
}
pokemon_sprites = PokemonSprites.objects.create(
@ -5099,6 +5103,25 @@ class APITests(APIData, APITestCase):
"{}".format(cries_data["legacy"]),
)
# test search pokemon using search query param `q=partial_name`
response = self.client.get(
"{}/pokemon/?q={}".format(API_V2, pokemon.name[:2]),
HTTP_HOST="testserver",
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["count"], 1)
self.assertEqual(response.data["results"][0]["name"], pokemon.name)
response = self.client.get(
"{}/pokemon/?q={}".format(API_V2, pokemon.name[-3:]),
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["count"], 1)
self.assertEqual(response.data["results"][0]["name"], pokemon.name)
def test_pokemon_form_api(self):
pokemon_species = self.setup_pokemon_species_data()
pokemon = self.setup_pokemon_data(pokemon_species=pokemon_species)

View file

@ -11,3 +11,4 @@ mimeparse==0.1.3
psycopg2-binary==2.9.9
python-dateutil==2.8.2
python-mimeparse==1.6.0
drf-spectacular==0.27.2