mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-28 22:30:25 +00:00
Serving lists/details and full ability detail data
This commit is contained in:
parent
8eff28a872
commit
ff63705a4d
8 changed files with 837 additions and 16 deletions
20
pokemon_v2/migrations/0002_auto_20150910_0153.py
Normal file
20
pokemon_v2/migrations/0002_auto_20150910_0153.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0001_squashed_0013_auto_20150420_0114'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='descriptions', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
44
pokemon_v2/migrations/0003_auto_20150910_0223.py
Normal file
44
pokemon_v2/migrations/0003_auto_20150910_0223.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0002_auto_20150910_0153'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitychange',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilitychange_descriptions', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilitydescription_descriptions', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityflavortext',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilityflavortext_descriptions', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityname',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilityname_descriptions', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonability',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='pokemonability_descriptions', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
44
pokemon_v2/migrations/0004_auto_20150910_0225.py
Normal file
44
pokemon_v2/migrations/0004_auto_20150910_0225.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0003_auto_20150910_0223'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitychange',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilitychange', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilitydescription', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityflavortext',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilityflavortext', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityname',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='abilityname', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonability',
|
||||
name='ability',
|
||||
field=models.ForeignKey(related_name='pokemonability', blank=True, to='pokemon_v2.Ability', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
326
pokemon_v2/migrations/0005_auto_20150910_0353.py
Normal file
326
pokemon_v2/migrations/0005_auto_20150910_0353.py
Normal file
|
@ -0,0 +1,326 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0004_auto_20150910_0225'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitychangedescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilitychangedescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilitydescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilityflavortext', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilityname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='berryfirmnessname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='berryfirmnessname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='characteristicdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='characteristicdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contesteffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='contesteffectdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contesttypename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='contesttypename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='egggroupname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='egggroupname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='encounterconditionname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='encounterconditionname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='encounterconditionvaluename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='encounterconditionvaluename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='encountermethodname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='encountermethodname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='evolutiontriggername',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='evolutiontriggername', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='generationname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='generationname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='growthratedescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='growthratedescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemcategoryname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemcategoryname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemflagdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemflagdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemflavortext', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemflingeffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemflingeffectdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itempocketname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itempocketname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='languagename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='languagename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='locationareaname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='locationareaname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='locationname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='locationname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movebattlestylename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movebattlestylename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movedamageclassdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movedamageclassdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveeffectchangedescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveeffectchangedescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveeffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveeffectdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveflagdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveflagdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveflavortext', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movemetaailmentname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movemetaailmentname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movemetacategorydescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movemetacategorydescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movetargetdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movetargetdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='naturename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='naturename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='palparkareaname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='palparkareaname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokeathlonstatname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokeathlonstatname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokedexdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokedexdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemoncolorname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemoncolorname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonformname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonformname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonhabitatname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonhabitatname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonmovemethodname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonmovemethodname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonshapename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonshapename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonspeciesdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonspeciesdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonspeciesflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonspeciesflavortext', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonspeciesname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonspeciesname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='regionname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='regionname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='statname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='statname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supercontesteffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='supercontesteffectdescription', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='typename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='typename', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='versionname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='versionname', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
326
pokemon_v2/migrations/0006_auto_20150910_0357.py
Normal file
326
pokemon_v2/migrations/0006_auto_20150910_0357.py
Normal file
|
@ -0,0 +1,326 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0005_auto_20150910_0353'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitychangedescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilitychangedescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilitydescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilityflavortextlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilityname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='abilitynamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='berryfirmnessname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='berryfirmnessnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='characteristicdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='characteristicdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contesteffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='contesteffectdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contesttypename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='contesttypenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='egggroupname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='egggroupnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='encounterconditionname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='encounterconditionnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='encounterconditionvaluename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='encounterconditionvaluenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='encountermethodname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='encountermethodnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='evolutiontriggername',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='evolutiontriggernamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='generationname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='generationnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='growthratedescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='growthratedescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemcategoryname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemcategorynamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemflagdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemflagdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemflavortextlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemflingeffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemflingeffectdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itemname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itemnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='itempocketname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='itempocketnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='languagename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='languagenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='locationareaname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='locationareanamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='locationname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='locationnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movebattlestylename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movebattlestylenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movedamageclassdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movedamageclassdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveeffectchangedescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveeffectchangedescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveeffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveeffectdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveflagdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveflagdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='moveflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='moveflavortextlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movemetaailmentname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movemetaailmentnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movemetacategorydescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movemetacategorydescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='movetargetdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='movetargetdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='naturename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='naturenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='palparkareaname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='palparkareanamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokeathlonstatname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokeathlonstatnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokedexdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokedexdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemoncolorname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemoncolornamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonformname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonformnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonhabitatname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonhabitatnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonmovemethodname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonmovemethodnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonshapename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonshapenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonspeciesdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonspeciesdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonspeciesflavortext',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonspeciesflavortextlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pokemonspeciesname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='pokemonspeciesnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='regionname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='regionnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='statname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='statnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supercontesteffectdescription',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='supercontesteffectdescriptionlanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='typename',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='typenamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='versionname',
|
||||
name='language',
|
||||
field=models.ForeignKey(related_name='versionnamelanguage', blank=True, to='pokemon_v2.Language', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -8,7 +8,7 @@ from django.db import models
|
|||
|
||||
class HasAbility(models.Model):
|
||||
|
||||
ability = models.ForeignKey('Ability', blank=True, null=True)
|
||||
ability = models.ForeignKey('Ability', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -152,7 +152,7 @@ class HasItemPocket(models.Model):
|
|||
|
||||
class HasLanguage(models.Model):
|
||||
|
||||
language = models.ForeignKey('Language', blank = True, null = True)
|
||||
language = models.ForeignKey('Language', blank = True, null = True, related_name="%(class)slanguage")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
|
|
@ -9,14 +9,69 @@ PokeAPI v2 serializers
|
|||
from .models import *
|
||||
|
||||
|
||||
class AbilitySerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
Serializer for the Ability resource
|
||||
"""
|
||||
class LanguageSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Language
|
||||
|
||||
#########################
|
||||
# ABILITY SERIALIZERS #
|
||||
#########################
|
||||
|
||||
class AbilityDescriptionSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = AbilityDescription
|
||||
fields = ('effect', 'short_effect', 'language')
|
||||
|
||||
|
||||
class AbilityFlavorTextSerializer(serializers.ModelSerializer):
|
||||
|
||||
text = serializers.CharField(source="flavor_text")
|
||||
# language = LanguageSerializer(source="abilityflavortextlanguage")
|
||||
|
||||
class Meta:
|
||||
model = AbilityFlavorText
|
||||
fields = ('text', 'language', 'version_group')
|
||||
|
||||
|
||||
class AbilityNameSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = AbilityName
|
||||
fields = ('name', 'language')
|
||||
|
||||
|
||||
class AbilityListSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Ability
|
||||
|
||||
|
||||
class AbilitySerializer(serializers.ModelSerializer):
|
||||
|
||||
descriptions = AbilityDescriptionSerializer(many=True, read_only=True, source="abilitydescription")
|
||||
flavor_text_entries = AbilityFlavorTextSerializer(many=True, read_only=True, source="abilityflavortext")
|
||||
names = AbilityNameSerializer(many=True, read_only=True, source="abilityname")
|
||||
|
||||
class Meta:
|
||||
model = Ability
|
||||
fields = (
|
||||
'id',
|
||||
'name',
|
||||
'is_main_series',
|
||||
'generation',
|
||||
'names',
|
||||
'descriptions',
|
||||
'flavor_text_entries'
|
||||
)
|
||||
|
||||
|
||||
|
||||
#########################
|
||||
# BERRY SERIALIZERS #
|
||||
#########################
|
||||
|
||||
class BerrySerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
Serializer for the Berry resource
|
||||
|
|
|
@ -7,23 +7,28 @@ from .serializers import *
|
|||
import re
|
||||
|
||||
|
||||
class NameOrIdLookupMixin(viewsets.ReadOnlyModelViewSet):
|
||||
class PokeapiCommonViewset(viewsets.ReadOnlyModelViewSet):
|
||||
"""
|
||||
This will allow a resource to be looked up by name or id (pk in this case).
|
||||
"""
|
||||
idPattern = re.compile("^[0-9]+$")
|
||||
namePattern = re.compile("^[0-9A-Za-z\-]+$")
|
||||
list_serializer_class = None
|
||||
|
||||
def get_serializer_class(self):
|
||||
if (self.action == 'list' and self.list_serializer_class != None):
|
||||
return self.list_serializer_class
|
||||
return self.serializer_class
|
||||
|
||||
def get_object(self):
|
||||
|
||||
queryset = self.get_queryset()
|
||||
queryset = self.filter_queryset(queryset)
|
||||
lookup = self.kwargs['pk']
|
||||
|
||||
if (self.idPattern.match(lookup)):
|
||||
if self.idPattern.match(lookup):
|
||||
resp = get_object_or_404(queryset, pk=lookup)
|
||||
|
||||
elif (self.namePattern.match(lookup)):
|
||||
elif self.namePattern.match(lookup):
|
||||
resp = get_object_or_404(queryset, name=lookup)
|
||||
|
||||
else:
|
||||
|
@ -32,15 +37,16 @@ class NameOrIdLookupMixin(viewsets.ReadOnlyModelViewSet):
|
|||
return resp
|
||||
|
||||
|
||||
class AbilityResource(NameOrIdLookupMixin):
|
||||
class AbilityResource(PokeapiCommonViewset):
|
||||
"""
|
||||
Views for the Ability V2 Resource
|
||||
"""
|
||||
queryset = Ability.objects.all()
|
||||
serializer_class = AbilitySerializer
|
||||
list_serializer_class = AbilityListSerializer
|
||||
|
||||
|
||||
class GenerationResource(NameOrIdLookupMixin):
|
||||
class GenerationResource(PokeapiCommonViewset):
|
||||
"""
|
||||
Views for the Generation V2 Resource
|
||||
"""
|
||||
|
@ -48,7 +54,7 @@ class GenerationResource(NameOrIdLookupMixin):
|
|||
serializer_class = GenerationSerializer
|
||||
|
||||
|
||||
class MoveResource(NameOrIdLookupMixin):
|
||||
class MoveResource(PokeapiCommonViewset):
|
||||
"""
|
||||
Views for the Move V2 Resource
|
||||
"""
|
||||
|
@ -56,7 +62,7 @@ class MoveResource(NameOrIdLookupMixin):
|
|||
serializer_class = MoveSerializer
|
||||
|
||||
|
||||
class NatureResource(NameOrIdLookupMixin):
|
||||
class NatureResource(PokeapiCommonViewset):
|
||||
"""
|
||||
Views for the Nature V2 Resource
|
||||
"""
|
||||
|
@ -64,7 +70,7 @@ class NatureResource(NameOrIdLookupMixin):
|
|||
serializer_class = NatureSerializer
|
||||
|
||||
|
||||
class PokemonResource(NameOrIdLookupMixin):
|
||||
class PokemonResource(PokeapiCommonViewset):
|
||||
"""
|
||||
Views for the Pokemon V2 Resource
|
||||
"""
|
||||
|
@ -72,7 +78,7 @@ class PokemonResource(NameOrIdLookupMixin):
|
|||
serializer_class = PokemonSerializer
|
||||
|
||||
|
||||
class TypeResource(NameOrIdLookupMixin):
|
||||
class TypeResource(PokeapiCommonViewset):
|
||||
"""
|
||||
Views for the Type V2 Resource
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue