Renamed PokemonMoveMethod models to MoveLearnMethod because it just damn well makes more sense when I'm reading the code and I assume anyone else will feel the same way. Also, progress on many api resources.

This commit is contained in:
Adickes 2015-09-26 23:20:19 -05:00
parent b9c0cbf4b3
commit 163e29c527
11 changed files with 686 additions and 847 deletions

View file

@ -49,15 +49,21 @@ router = routers.DefaultRouter()
router.register(r"ability", AbilityResource)
router.register(r"generation", GenerationResource)
router.register(r"growthrate", GrowthRateResource)
router.register(r"growth-rate", GrowthRateResource)
router.register(r"language", LanguageResource)
router.register(r"move", MoveResource)
router.register(r"move-ailment", MoveMetaAilmentResource)
router.register(r"move-category", MoveMetaCategoryResource)
router.register(r"move-damage-class", MoveDamageClassResource)
router.register(r"move-learn-method", MoveLearnMethodResource)
router.register(r"move-target", MoveTargetResource)
router.register(r"nature", NatureResource)
router.register(r"pokedex", PokedexResource)
router.register(r"pokemon", PokemonResource)
router.register(r"pokemon-shape", PokemonShapeResource)
router.register(r"pokemon-color", PokemonColorResource)
router.register(r"region", RegionResource)
router.register(r"stat", StatResource)
router.register(r"type", TypeResource)
router.register(r"version", VersionResource)
router.register(r"version-group", VersionGroupResource)

View file

@ -796,6 +796,33 @@ for index, info in enumerate(data):
)
model.save()
clearTable(MoveLearnMethod)
data = loadData('pokemon_move_methods.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveLearnMethod (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveLearnMethodName)
data = loadData('pokemon_move_method_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveLearnMethodName (
move_learn_method = MoveLearnMethod.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
clearTable(MoveTarget)
data = loadData('move_targets.csv')
@ -1742,9 +1769,9 @@ for index, info in enumerate(data):
model = PokemonForm (
id = int(info[0]),
name = info[1],
form_identifier = info[2],
form_name = info[2],
pokemon = Pokemon.objects.get(pk = int(info[3])),
introduced_in_version_group = VersionGroup.objects.get(pk = int(info[4])),
version_group = VersionGroup.objects.get(pk = int(info[4])),
is_default = bool(int(info[5])),
is_battle_only = bool(int(info[6])),
is_mega = bool(int(info[7])),
@ -1840,34 +1867,6 @@ for index, info in enumerate(data):
model.save()
clearTable(PokemonMoveMethod)
data = loadData('pokemon_move_methods.csv')
for index, info in enumerate(data):
if index > 0:
model = PokemonMoveMethod (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(PokemonMoveMethodName)
data = loadData('pokemon_move_method_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = PokemonMoveMethodName (
pokemon_move_method = PokemonMoveMethod.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
clearTable(PokemonMove)
data = loadData('pokemon_moves.csv')
@ -1878,7 +1877,7 @@ for index, info in enumerate(data):
pokemon = Pokemon.objects.get(pk = int(info[0])),
version_group = VersionGroup.objects.get(pk = int(info[1])),
move = Move.objects.get(pk = int(info[2])),
pokemon_move_method = PokemonMoveMethod.objects.get(pk = int(info[3])),
move_learn_method = MoveLearnMethod.objects.get(pk = int(info[3])),
level = int(info[4]),
order = int(info[5]) if info[5] != '' else None,
)

View file

@ -91,6 +91,8 @@ admin.site.register(MoveFlagMap)
admin.site.register(MoveFlagDescription)
admin.site.register(MoveFlag)
admin.site.register(MoveFlavorText)
admin.site.register(MoveLearnMethod)
admin.site.register(MoveLearnMethodName)
admin.site.register(MoveMeta)
admin.site.register(MoveMetaAilment)
admin.site.register(MoveMetaAilmentName)
@ -133,8 +135,6 @@ admin.site.register(PokemonHabitat)
admin.site.register(PokemonHabitatName)
admin.site.register(PokemonItem)
admin.site.register(PokemonMove)
admin.site.register(PokemonMoveMethod)
admin.site.register(PokemonMoveMethodName)
admin.site.register(PokemonShape)
admin.site.register(PokemonShapeName)
admin.site.register(PokemonSpecies)
@ -162,5 +162,5 @@ admin.site.register(TypeEfficacy)
admin.site.register(Version)
admin.site.register(VersionName)
admin.site.register(VersionGroup)
admin.site.register(VersionGroupMoveLearnMethod)
admin.site.register(VersionGroupRegion)
admin.site.register(VersionGroupPokemonMoveMethod)

View file

@ -6,7 +6,7 @@ from django.db import models, migrations
class Migration(migrations.Migration):
replaces = [(b'pokemon_v2', '0001_squashed_0006_auto_20150910_0357'), (b'pokemon_v2', '0002_auto_20150914_1324'), (b'pokemon_v2', '0003_auto_20150915_0055'), (b'pokemon_v2', '0004_auto_20150915_0448'), (b'pokemon_v2', '0005_auto_20150918_0502')]
# replaces = [(b'pokemon_v2', '0001_squashed_0005_auto_20150918_0502'), (b'pokemon_v2', '0002_auto_20150921_0054'), (b'pokemon_v2', '0003_auto_20150921_0437'), (b'pokemon_v2', '0004_auto_20150925_1521'), (b'pokemon_v2', '0005_auto_20150925_1527'), (b'pokemon_v2', '0006_auto_20150926_0832'), (b'pokemon_v2', '0007_auto_20150926_0850'), (b'pokemon_v2', '0008_auto_20150926_0855'), (b'pokemon_v2', '0009_auto_20150926_0858'), (b'pokemon_v2', '0010_auto_20150926_0900'), (b'pokemon_v2', '0011_auto_20150926_0905'), (b'pokemon_v2', '0012_auto_20150926_0907'), (b'pokemon_v2', '0013_auto_20150926_0913')]
dependencies = [
]
@ -138,18 +138,6 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.CreateModel(
name='VersionGroupPokemonMoveMethod',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('pokemon_move_method_id', models.IntegerField()),
('version_group', models.ForeignKey(related_name='versiongrouppokemonmovemethod', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='VersionGroupRegion',
fields=[
@ -366,7 +354,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.CharField(default='', max_length=1000)),
('characteristic', models.ForeignKey(blank=True, to='pokemon_v2.Characteristic', null=True)),
('characteristic', models.ForeignKey(related_name='characteristicdescription', blank=True, to='pokemon_v2.Characteristic', null=True)),
('language', models.ForeignKey(related_name='characteristicdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -390,7 +378,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('egg_group', models.ForeignKey(blank=True, to='pokemon_v2.EggGroup', null=True)),
('egg_group', models.ForeignKey(related_name='egggroupname', blank=True, to='pokemon_v2.EggGroup', null=True)),
('language', models.ForeignKey(related_name='egggroupname_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -414,7 +402,7 @@ class Migration(migrations.Migration):
name='GrowthRateDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('growth_rate', models.ForeignKey(blank=True, to='pokemon_v2.GrowthRate', null=True)),
('growth_rate', models.ForeignKey(related_name='growthratedescription', blank=True, to='pokemon_v2.GrowthRate', null=True)),
('language', models.ForeignKey(related_name='growthratedescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('description', models.CharField(default='', max_length=1000)),
],
@ -584,7 +572,7 @@ class Migration(migrations.Migration):
name='MoveFlagMap',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('move', models.ForeignKey(blank=True, to='pokemon_v2.Move', null=True)),
('move', models.ForeignKey(related_name='moveflagmap', blank=True, to='pokemon_v2.Move', null=True)),
('move_flag', models.ForeignKey(blank=True, to='pokemon_v2.MoveFlag', null=True)),
],
options={
@ -598,7 +586,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('flavor_text', models.CharField(max_length=500)),
('language', models.ForeignKey(related_name='moveflavortext_language', blank=True, to='pokemon_v2.Language', null=True)),
('move', models.ForeignKey(blank=True, to='pokemon_v2.Move', null=True)),
('move', models.ForeignKey(related_name='moveflavortext', blank=True, to='pokemon_v2.Move', null=True)),
('version_group', models.ForeignKey(related_name='moveflavortext', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
@ -679,7 +667,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('change', models.IntegerField()),
('move', models.ForeignKey(blank=True, to='pokemon_v2.Move', null=True)),
('move', models.ForeignKey(related_name='movemetastatchange', blank=True, to='pokemon_v2.Move', null=True)),
('stat', models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True)),
],
options={
@ -693,7 +681,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='movename_language', blank=True, to='pokemon_v2.Language', null=True)),
('move', models.ForeignKey(blank=True, to='pokemon_v2.Move', null=True)),
('move', models.ForeignKey(related_name='movename', blank=True, to='pokemon_v2.Move', null=True)),
],
options={
'abstract': False,
@ -734,7 +722,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='movemeta',
name='move',
field=models.ForeignKey(blank=True, to='pokemon_v2.Move', null=True),
field=models.OneToOneField(related_name='movemeta', to='pokemon_v2.Move'),
preserve_default=True,
),
migrations.AddField(
@ -1261,7 +1249,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('evolution_trigger', models.ForeignKey(blank=True, to='pokemon_v2.EvolutionTrigger', null=True)),
('evolution_trigger', models.ForeignKey(related_name='evolutiontriggername', blank=True, to='pokemon_v2.EvolutionTrigger', null=True)),
('language', models.ForeignKey(related_name='evolutiontriggername_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -1275,7 +1263,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('level', models.IntegerField()),
('experience', models.IntegerField()),
('growth_rate', models.ForeignKey(blank=True, to='pokemon_v2.GrowthRate', null=True)),
('growth_rate', models.ForeignKey(related_name='experience', blank=True, to='pokemon_v2.GrowthRate', null=True)),
],
options={
'abstract': False,
@ -1355,7 +1343,7 @@ class Migration(migrations.Migration):
('is_hidden', models.BooleanField(default=False)),
('slot', models.IntegerField()),
('ability', models.ForeignKey(related_name='pokemonability', blank=True, to='pokemon_v2.Ability', null=True)),
('pokemon', models.ForeignKey(blank=True, to='pokemon_v2.Pokemon', null=True)),
('pokemon', models.ForeignKey(related_name='pokemonability', blank=True, to='pokemon_v2.Pokemon', null=True)),
],
options={
'abstract': False,
@ -1481,7 +1469,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('game_index', models.IntegerField()),
('pokemon', models.ForeignKey(blank=True, to='pokemon_v2.Pokemon', null=True)),
('pokemon', models.ForeignKey(related_name='pokemongameindex', blank=True, to='pokemon_v2.Pokemon', null=True)),
('version', models.ForeignKey(related_name='pokemongameindex', blank=True, to='pokemon_v2.Version', null=True)),
],
options={
@ -1530,10 +1518,11 @@ class Migration(migrations.Migration):
name='PokemonMove',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('order', models.IntegerField()),
('order', models.IntegerField(null=True, blank=True)),
('level', models.IntegerField()),
('move', models.ForeignKey(blank=True, to='pokemon_v2.Move', null=True)),
('pokemon', models.ForeignKey(blank=True, to='pokemon_v2.Pokemon', null=True)),
('move', models.ForeignKey(related_name='pokemonmove', blank=True, to='pokemon_v2.Move', null=True)),
('pokemon', models.ForeignKey(related_name='pokemonmove', blank=True, to='pokemon_v2.Pokemon', null=True)),
('version_group', models.ForeignKey(related_name='pokemonmove', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
'abstract': False,
@ -1541,7 +1530,7 @@ class Migration(migrations.Migration):
bases=(models.Model,),
),
migrations.CreateModel(
name='PokemonMoveMethod',
name='MoveLearnMethod',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
@ -1552,13 +1541,13 @@ class Migration(migrations.Migration):
bases=(models.Model,),
),
migrations.CreateModel(
name='PokemonMoveMethodName',
name='MoveLearnMethodName',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.CharField(default='', max_length=1000)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='pokemonmovemethodname_language', blank=True, to='pokemon_v2.Language', null=True)),
('pokemon_move_method', models.ForeignKey(blank=True, to='pokemon_v2.PokemonMoveMethod', null=True)),
('language', models.ForeignKey(related_name='movelearnmethodname_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_learn_method', models.ForeignKey(blank=True, to='pokemon_v2.MoveLearnMethod', null=True)),
],
options={
'abstract': False,
@ -1663,7 +1652,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('base_stat', models.IntegerField()),
('effort', models.IntegerField()),
('pokemon', models.ForeignKey(blank=True, to='pokemon_v2.Pokemon', null=True)),
('pokemon', models.ForeignKey(related_name='pokemonstat', blank=True, to='pokemon_v2.Pokemon', null=True)),
('stat', models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True)),
],
options={
@ -1676,7 +1665,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('slot', models.IntegerField()),
('pokemon', models.ForeignKey(blank=True, to='pokemon_v2.Pokemon', null=True)),
('pokemon', models.ForeignKey(related_name='pokemontype', blank=True, to='pokemon_v2.Pokemon', null=True)),
('type', models.ForeignKey(related_name='pokemontype', blank=True, to='pokemon_v2.Type', null=True)),
],
options={
@ -1684,18 +1673,6 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.AddField(
model_name='pokemonmove',
name='pokemon_move_method',
field=models.ForeignKey(blank=True, to='pokemon_v2.PokemonMoveMethod', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='pokemonmove',
name='version_group',
field=models.ForeignKey(related_name='pokemonmove', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='pokemonevolution',
name='evolved_species',
@ -1705,7 +1682,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='pokemonevolution',
name='gender',
field=models.ForeignKey(blank=True, to='pokemon_v2.Gender', null=True),
field=models.ForeignKey(related_name='pokemonevolution', blank=True, to='pokemon_v2.Gender', null=True),
preserve_default=True,
),
migrations.AddField(
@ -1883,12 +1860,6 @@ class Migration(migrations.Migration):
field=models.IntegerField(null=True, blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonmove',
name='order',
field=models.IntegerField(null=True, blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspecies',
name='order',
@ -1944,7 +1915,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('item_category', models.ForeignKey(blank=True, to='pokemon_v2.ItemCategory', null=True)),
('item_category', models.ForeignKey(related_name='itemcategoryname', blank=True, to='pokemon_v2.ItemCategory', null=True)),
('language', models.ForeignKey(related_name='itemcategoryname_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -1995,7 +1966,7 @@ class Migration(migrations.Migration):
name='ItemFlagMap',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('item', models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True)),
('item', models.ForeignKey(related_name='itemflagmap', blank=True, to='pokemon_v2.Item', null=True)),
('item_flag', models.ForeignKey(blank=True, to='pokemon_v2.ItemFlag', null=True)),
],
options={
@ -2008,7 +1979,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('flavor_text', models.CharField(max_length=500)),
('item', models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True)),
('item', models.ForeignKey(related_name='itemflavortext', blank=True, to='pokemon_v2.Item', null=True)),
('language', models.ForeignKey(related_name='itemflavortext_language', blank=True, to='pokemon_v2.Language', null=True)),
('version_group', models.ForeignKey(related_name='itemflavortext', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
@ -2031,7 +2002,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('item_fling_effect', models.ForeignKey(blank=True, to='pokemon_v2.ItemFlingEffect', null=True)),
('item_fling_effect', models.ForeignKey(related_name='itemflingeffectdescription', blank=True, to='pokemon_v2.ItemFlingEffect', null=True)),
('language', models.ForeignKey(related_name='itemflingeffectdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -2045,7 +2016,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('game_index', models.IntegerField()),
('generation', models.ForeignKey(related_name='itemgameindex', blank=True, to='pokemon_v2.Generation', null=True)),
('item', models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True)),
('item', models.ForeignKey(related_name='itemgameindex', blank=True, to='pokemon_v2.Item', null=True)),
],
options={
'abstract': False,
@ -2057,7 +2028,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('item', models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True)),
('item', models.ForeignKey(related_name='itemname', blank=True, to='pokemon_v2.Item', null=True)),
('language', models.ForeignKey(related_name='itemname_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -2081,7 +2052,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('item_pocket', models.ForeignKey(blank=True, to='pokemon_v2.ItemPocket', null=True)),
('item_pocket', models.ForeignKey(related_name='itempocketname', blank=True, to='pokemon_v2.ItemPocket', null=True)),
('language', models.ForeignKey(related_name='itempocketname_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -2092,19 +2063,19 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='itemcategory',
name='item_pocket',
field=models.ForeignKey(blank=True, to='pokemon_v2.ItemPocket', null=True),
field=models.ForeignKey(related_name='itemcategory', blank=True, to='pokemon_v2.ItemPocket', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='item',
name='item_category',
field=models.ForeignKey(blank=True, to='pokemon_v2.ItemCategory', null=True),
field=models.ForeignKey(related_name='item', blank=True, to='pokemon_v2.ItemCategory', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='item',
name='item_fling_effect',
field=models.ForeignKey(blank=True, to='pokemon_v2.ItemFlingEffect', null=True),
field=models.ForeignKey(related_name='item', blank=True, to='pokemon_v2.ItemFlingEffect', null=True),
preserve_default=True,
),
migrations.AddField(
@ -2116,7 +2087,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='machine',
name='item',
field=models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True),
field=models.ForeignKey(related_name='machine', blank=True, to='pokemon_v2.Item', null=True),
preserve_default=True,
),
migrations.AddField(
@ -2134,7 +2105,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='pokemonitem',
name='item',
field=models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True),
field=models.ForeignKey(related_name='pokemonitem', blank=True, to='pokemon_v2.Item', null=True),
preserve_default=True,
),
migrations.CreateModel(
@ -2243,7 +2214,7 @@ class Migration(migrations.Migration):
('name', models.CharField(max_length=100)),
('flavor', models.CharField(max_length=10)),
('color', models.CharField(max_length=10)),
('contest_type', models.ForeignKey(blank=True, to='pokemon_v2.ContestType', null=True)),
('contest_type', models.ForeignKey(related_name='contesttypename', blank=True, to='pokemon_v2.ContestType', null=True)),
('language', models.ForeignKey(related_name='contesttypename_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -2254,7 +2225,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='berryflavor',
name='contest_type',
field=models.ForeignKey(blank=True, to='pokemon_v2.ContestType', null=True),
field=models.ForeignKey(related_name='berryflavor', blank=True, to='pokemon_v2.ContestType', null=True),
preserve_default=True,
),
migrations.AddField(
@ -2266,7 +2237,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='berry',
name='item',
field=models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True),
field=models.ForeignKey(related_name='berry', blank=True, to='pokemon_v2.Item', null=True),
preserve_default=True,
),
migrations.AddField(
@ -2387,7 +2358,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='locationareaname_language', blank=True, to='pokemon_v2.Language', null=True)),
('location_area', models.ForeignKey(blank=True, to='pokemon_v2.LocationArea', null=True)),
('location_area', models.ForeignKey(related_name='locationareaname', blank=True, to='pokemon_v2.LocationArea', null=True)),
],
options={
'abstract': False,
@ -2400,7 +2371,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('game_index', models.IntegerField()),
('generation', models.ForeignKey(related_name='locationgameindex', blank=True, to='pokemon_v2.Generation', null=True)),
('location', models.ForeignKey(blank=True, to='pokemon_v2.Location', null=True)),
('location', models.ForeignKey(related_name='locationgameindex', blank=True, to='pokemon_v2.Location', null=True)),
],
options={
'abstract': False,
@ -2413,7 +2384,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='locationname_language', blank=True, to='pokemon_v2.Language', null=True)),
('location', models.ForeignKey(blank=True, to='pokemon_v2.Location', null=True)),
('location', models.ForeignKey(related_name='locationname', blank=True, to='pokemon_v2.Location', null=True)),
],
options={
'abstract': False,
@ -2451,7 +2422,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('encounter_condition', models.ForeignKey(blank=True, to='pokemon_v2.EncounterCondition', null=True)),
('encounter_condition', models.ForeignKey(related_name='encounterconditionname', blank=True, to='pokemon_v2.EncounterCondition', null=True)),
('language', models.ForeignKey(related_name='encounterconditionname_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -2513,7 +2484,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('encounter_method', models.ForeignKey(blank=True, to='pokemon_v2.EncounterMethod', null=True)),
('encounter_method', models.ForeignKey(related_name='encountermethodname', blank=True, to='pokemon_v2.EncounterMethod', null=True)),
('language', models.ForeignKey(related_name='encountermethodname_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -2527,7 +2498,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('slot', models.IntegerField(null=True, blank=True)),
('rarity', models.IntegerField()),
('encounter_method', models.ForeignKey(blank=True, to='pokemon_v2.EncounterMethod', null=True)),
('encounter_method', models.ForeignKey(related_name='encounterslot', blank=True, to='pokemon_v2.EncounterMethod', null=True)),
('version_group', models.ForeignKey(related_name='encounterslot', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
@ -2538,7 +2509,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='locationareaencounterrate',
name='encounter_method',
field=models.ForeignKey(blank=True, to='pokemon_v2.EncounterMethod', null=True),
field=models.ForeignKey(related_name='locationareaencounterrate', blank=True, to='pokemon_v2.EncounterMethod', null=True),
preserve_default=True,
),
migrations.AddField(
@ -2839,4 +2810,104 @@ class Migration(migrations.Migration):
field=models.ForeignKey(related_name='pokemondexnumber', blank=True, to='pokemon_v2.Pokedex', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounter',
name='location_area',
field=models.ForeignKey(related_name='encounter', blank=True, to='pokemon_v2.LocationArea', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounter',
name='pokemon',
field=models.ForeignKey(related_name='encounter', blank=True, to='pokemon_v2.Pokemon', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounterconditionvalue',
name='encounter_condition',
field=models.ForeignKey(related_name='encounterconditionvalue', blank=True, to='pokemon_v2.EncounterCondition', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationarea',
name='location',
field=models.ForeignKey(related_name='locationarea', blank=True, to='pokemon_v2.Location', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationareaencounterrate',
name='location_area',
field=models.ForeignKey(related_name='locationareaencounterrate', blank=True, to='pokemon_v2.LocationArea', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='machine',
name='growth_rate',
field=models.ForeignKey(related_name='machine', blank=True, to='pokemon_v2.GrowthRate', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movechange',
name='move',
field=models.ForeignKey(related_name='movechange', blank=True, to='pokemon_v2.Move', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonegggroup',
name='egg_group',
field=models.ForeignKey(related_name='pokemonegggroup', blank=True, to='pokemon_v2.EggGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonevolution',
name='evolution_trigger',
field=models.ForeignKey(related_name='pokemonevolution', blank=True, to='pokemon_v2.EvolutionTrigger', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonform',
name='pokemon',
field=models.ForeignKey(related_name='pokemonform', blank=True, to='pokemon_v2.Pokemon', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonitem',
name='pokemon',
field=models.ForeignKey(related_name='pokemonitem', blank=True, to='pokemon_v2.Pokemon', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspecies',
name='growth_rate',
field=models.ForeignKey(related_name='pokemonspecies', blank=True, to='pokemon_v2.GrowthRate', null=True),
preserve_default=True,
),
migrations.RenameField(
model_name='pokemonform',
old_name='form_identifier',
new_name='form_name',
),
migrations.RenameField(
model_name='pokemonform',
old_name='introduced_in_version_group',
new_name='version_group',
),
migrations.AddField(
model_name='pokemonmove',
name='move_learn_method',
field=models.ForeignKey(blank=True, to='pokemon_v2.MoveLearnMethod', null=True),
preserve_default=True,
),
migrations.CreateModel(
name='VersionGroupMoveLearnMethod',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('move_learn_method', models.ForeignKey(blank=True, to='pokemon_v2.MoveLearnMethod', null=True)),
('version_group', models.ForeignKey(related_name='versiongroupmovelearnmethod', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
]

View file

@ -1,554 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0001_squashed_0006_auto_20150910_0357'),
]
operations = [
migrations.AlterField(
model_name='ability',
name='generation',
field=models.ForeignKey(related_name='ability', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='abilitychangedescription',
name='language',
field=models.ForeignKey(related_name='abilitychangedescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='abilitydescription',
name='language',
field=models.ForeignKey(related_name='abilitydescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='abilityflavortext',
name='language',
field=models.ForeignKey(related_name='abilityflavortext_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='abilityflavortext',
name='version_group',
field=models.ForeignKey(related_name='abilityflavortext', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='abilityname',
name='language',
field=models.ForeignKey(related_name='abilityname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='berryfirmnessname',
name='language',
field=models.ForeignKey(related_name='berryfirmnessname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='characteristicdescription',
name='language',
field=models.ForeignKey(related_name='characteristicdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='contesteffectdescription',
name='language',
field=models.ForeignKey(related_name='contesteffectdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='contesttypename',
name='language',
field=models.ForeignKey(related_name='contesttypename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='egggroupname',
name='language',
field=models.ForeignKey(related_name='egggroupname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounter',
name='version',
field=models.ForeignKey(related_name='encounter', blank=True, to='pokemon_v2.Version', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounterconditionname',
name='language',
field=models.ForeignKey(related_name='encounterconditionname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounterconditionvaluename',
name='language',
field=models.ForeignKey(related_name='encounterconditionvaluename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encountermethodname',
name='language',
field=models.ForeignKey(related_name='encountermethodname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounterslot',
name='version_group',
field=models.ForeignKey(related_name='encounterslot', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='evolutiontriggername',
name='language',
field=models.ForeignKey(related_name='evolutiontriggername_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='generation',
name='region',
field=models.ForeignKey(related_name='generation', blank=True, to='pokemon_v2.Region', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='generationname',
name='generation',
field=models.ForeignKey(related_name='generationname', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='generationname',
name='language',
field=models.ForeignKey(related_name='generationname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='growthratedescription',
name='language',
field=models.ForeignKey(related_name='growthratedescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemcategoryname',
name='language',
field=models.ForeignKey(related_name='itemcategoryname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemdescription',
name='language',
field=models.ForeignKey(related_name='itemdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemflagdescription',
name='language',
field=models.ForeignKey(related_name='itemflagdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemflavortext',
name='language',
field=models.ForeignKey(related_name='itemflavortext_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemflavortext',
name='version_group',
field=models.ForeignKey(related_name='itemflavortext', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemflingeffectdescription',
name='language',
field=models.ForeignKey(related_name='itemflingeffectdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemgameindex',
name='generation',
field=models.ForeignKey(related_name='itemgameindex', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemname',
name='language',
field=models.ForeignKey(related_name='itemname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itempocketname',
name='language',
field=models.ForeignKey(related_name='itempocketname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='languagename',
name='language',
field=models.ForeignKey(related_name='languagename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='location',
name='region',
field=models.ForeignKey(related_name='location', blank=True, to='pokemon_v2.Region', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationareaencounterrate',
name='version',
field=models.ForeignKey(related_name='locationareaencounterrate', blank=True, to='pokemon_v2.Version', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationareaname',
name='language',
field=models.ForeignKey(related_name='locationareaname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationgameindex',
name='generation',
field=models.ForeignKey(related_name='locationgameindex', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationname',
name='language',
field=models.ForeignKey(related_name='locationname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='move',
name='generation',
field=models.ForeignKey(related_name='move', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='move',
name='type',
field=models.ForeignKey(related_name='move', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movebattlestylename',
name='language',
field=models.ForeignKey(related_name='movebattlestylename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movechange',
name='type',
field=models.ForeignKey(related_name='movechange', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movechange',
name='version_group',
field=models.ForeignKey(related_name='movechange', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movedamageclassdescription',
name='language',
field=models.ForeignKey(related_name='movedamageclassdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveeffectchange',
name='version_group',
field=models.ForeignKey(related_name='moveeffectchange', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveeffectchangedescription',
name='language',
field=models.ForeignKey(related_name='moveeffectchangedescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveeffectdescription',
name='language',
field=models.ForeignKey(related_name='moveeffectdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveflagdescription',
name='language',
field=models.ForeignKey(related_name='moveflagdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveflavortext',
name='language',
field=models.ForeignKey(related_name='moveflavortext_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveflavortext',
name='version_group',
field=models.ForeignKey(related_name='moveflavortext', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movemetaailmentname',
name='language',
field=models.ForeignKey(related_name='movemetaailmentname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movemetacategorydescription',
name='language',
field=models.ForeignKey(related_name='movemetacategorydescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movename',
name='language',
field=models.ForeignKey(related_name='movename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movetargetdescription',
name='language',
field=models.ForeignKey(related_name='movetargetdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='naturename',
name='language',
field=models.ForeignKey(related_name='naturename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='palparkareaname',
name='language',
field=models.ForeignKey(related_name='palparkareaname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokeathlonstatname',
name='language',
field=models.ForeignKey(related_name='pokeathlonstatname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokedex',
name='region',
field=models.ForeignKey(related_name='pokedex', blank=True, to='pokemon_v2.Region', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokedexdescription',
name='language',
field=models.ForeignKey(related_name='pokedexdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokedexversiongroup',
name='version_group',
field=models.ForeignKey(related_name='pokedexversiongroup', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemoncolorname',
name='language',
field=models.ForeignKey(related_name='pokemoncolorname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonformgeneration',
name='generation',
field=models.ForeignKey(related_name='pokemonformgeneration', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonformname',
name='language',
field=models.ForeignKey(related_name='pokemonformname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemongameindex',
name='version',
field=models.ForeignKey(related_name='pokemongameindex', blank=True, to='pokemon_v2.Version', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonhabitatname',
name='language',
field=models.ForeignKey(related_name='pokemonhabitatname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonitem',
name='version',
field=models.ForeignKey(related_name='pokemonitem', blank=True, to='pokemon_v2.Version', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonmove',
name='version_group',
field=models.ForeignKey(related_name='pokemonmove', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonmovemethodname',
name='language',
field=models.ForeignKey(related_name='pokemonmovemethodname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonshapename',
name='language',
field=models.ForeignKey(related_name='pokemonshapename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspecies',
name='generation',
field=models.ForeignKey(related_name='pokemonspecies', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesdescription',
name='language',
field=models.ForeignKey(related_name='pokemonspeciesdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesflavortext',
name='language',
field=models.ForeignKey(related_name='pokemonspeciesflavortext_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesflavortext',
name='version',
field=models.ForeignKey(related_name='pokemonspeciesflavortext', blank=True, to='pokemon_v2.Version', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesname',
name='language',
field=models.ForeignKey(related_name='pokemonspeciesname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemontype',
name='type',
field=models.ForeignKey(related_name='pokemontype', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='regionname',
name='language',
field=models.ForeignKey(related_name='regionname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='regionname',
name='region',
field=models.ForeignKey(related_name='regionname', blank=True, to='pokemon_v2.Region', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='statname',
name='language',
field=models.ForeignKey(related_name='statname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='supercontesteffectdescription',
name='language',
field=models.ForeignKey(related_name='supercontesteffectdescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='type',
name='generation',
field=models.ForeignKey(related_name='type', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='typeefficacy',
name='damage_type_id',
field=models.ForeignKey(related_name='damage_type', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='typeefficacy',
name='target_type_id',
field=models.ForeignKey(related_name='target_type', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='typegameindex',
name='generation',
field=models.ForeignKey(related_name='typegameindex', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='typegameindex',
name='type',
field=models.ForeignKey(related_name='typegameindex', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='typename',
name='language',
field=models.ForeignKey(related_name='typename_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='typename',
name='type',
field=models.ForeignKey(related_name='typename', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='version',
name='version_group',
field=models.ForeignKey(related_name='version', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='versiongroup',
name='generation',
field=models.ForeignKey(related_name='versiongroup', blank=True, to='pokemon_v2.Generation', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='versiongrouppokemonmovemethod',
name='version_group',
field=models.ForeignKey(related_name='versiongrouppokemonmovemethod', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='versiongroupregion',
name='region',
field=models.ForeignKey(related_name='versiongroupregion', blank=True, to='pokemon_v2.Region', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='versiongroupregion',
name='version_group',
field=models.ForeignKey(related_name='versiongroupregion', blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='versionname',
name='language',
field=models.ForeignKey(related_name='versionname_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
]

View file

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0002_auto_20150914_1324'),
]
operations = [
migrations.RemoveField(
model_name='typeefficacy',
name='damage_type_id',
),
migrations.RemoveField(
model_name='typeefficacy',
name='target_type_id',
),
migrations.AddField(
model_name='typeefficacy',
name='damage_type',
field=models.ForeignKey(related_name='damage_type', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='typeefficacy',
name='target_type',
field=models.ForeignKey(related_name='target_type', blank=True, to='pokemon_v2.Type', null=True),
preserve_default=True,
),
]

View file

@ -1,74 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0003_auto_20150915_0055'),
]
operations = [
migrations.AlterField(
model_name='palpark',
name='pokemon_species',
field=models.ForeignKey(related_name='palpark', blank=True, to='pokemon_v2.PokemonSpecies', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokedexdescription',
name='pokedex',
field=models.ForeignKey(related_name='pokedexdescription', blank=True, to='pokemon_v2.Pokedex', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokedexversiongroup',
name='pokedex',
field=models.ForeignKey(related_name='pokedexversiongroup', blank=True, to='pokemon_v2.Pokedex', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemon',
name='pokemon_species',
field=models.ForeignKey(related_name='pokemon', blank=True, to='pokemon_v2.PokemonSpecies', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemondexnumber',
name='pokedex',
field=models.ForeignKey(related_name='pokemondexnumber', blank=True, to='pokemon_v2.Pokedex', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemondexnumber',
name='pokemon_species',
field=models.ForeignKey(related_name='pokemondexnumber', blank=True, to='pokemon_v2.PokemonSpecies', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonegggroup',
name='pokemon_species',
field=models.ForeignKey(related_name='pokemonegggroup', blank=True, to='pokemon_v2.PokemonSpecies', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesdescription',
name='pokemon_species',
field=models.ForeignKey(related_name='pokemonspeciesdescription', blank=True, to='pokemon_v2.PokemonSpecies', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesflavortext',
name='pokemon_species',
field=models.ForeignKey(related_name='pokemonspeciesflavortext', blank=True, to='pokemon_v2.PokemonSpecies', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesname',
name='pokemon_species',
field=models.ForeignKey(related_name='pokemonspeciesname', blank=True, to='pokemon_v2.PokemonSpecies', null=True),
preserve_default=True,
),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0004_auto_20150915_0448'),
]
operations = [
migrations.AlterField(
model_name='pokemonshapename',
name='pokemon_shape',
field=models.ForeignKey(related_name='pokemonshapename', blank=True, to='pokemon_v2.PokemonShape', null=True),
preserve_default=True,
),
]

View file

@ -16,7 +16,7 @@ class HasAbility(models.Model):
class HasCharacteristic(models.Model):
characteristic = models.ForeignKey('Characteristic', blank=True, null=True)
characteristic = models.ForeignKey('Characteristic', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -24,7 +24,7 @@ class HasCharacteristic(models.Model):
class HasContestType(models.Model):
contest_type = models.ForeignKey('ContestType', blank=True, null=True)
contest_type = models.ForeignKey('ContestType', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -40,7 +40,7 @@ class HasDescription(models.Model):
class HasGender(models.Model):
gender = models.ForeignKey('Gender', blank=True, null=True)
gender = models.ForeignKey('Gender', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -56,7 +56,7 @@ class HasEffect(models.Model):
class HasEggGroup(models.Model):
egg_group = models.ForeignKey('EggGroup', blank=True, null=True)
egg_group = models.ForeignKey('EggGroup', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -64,7 +64,7 @@ class HasEggGroup(models.Model):
class HasEncounterMethod(models.Model):
encounter_method = models.ForeignKey('EncounterMethod', blank=True, null=True)
encounter_method = models.ForeignKey('EncounterMethod', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -72,7 +72,7 @@ class HasEncounterMethod(models.Model):
class HasEncounterCondition(models.Model):
encounter_condition = models.ForeignKey('EncounterCondition', blank=True, null=True)
encounter_condition = models.ForeignKey('EncounterCondition', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -80,7 +80,7 @@ class HasEncounterCondition(models.Model):
class HasEvolutionTrigger(models.Model):
evolution_trigger = models.ForeignKey('EvolutionTrigger', blank=True, null=True)
evolution_trigger = models.ForeignKey('EvolutionTrigger', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -96,7 +96,7 @@ class HasFlavorText(models.Model):
class HasFlingEffect(models.Model):
item_fling_effect = models.ForeignKey('ItemFlingEffect', blank=True, null=True)
item_fling_effect = models.ForeignKey('ItemFlingEffect', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -120,7 +120,7 @@ class HasGeneration(models.Model):
class HasGrowthRate(models.Model):
growth_rate = models.ForeignKey('GrowthRate', blank=True, null=True)
growth_rate = models.ForeignKey('GrowthRate', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -128,7 +128,7 @@ class HasGrowthRate(models.Model):
class HasItem(models.Model):
item = models.ForeignKey('Item', blank=True, null=True)
item = models.ForeignKey('Item', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -136,7 +136,7 @@ class HasItem(models.Model):
class HasItemCategory(models.Model):
item_category = models.ForeignKey('ItemCategory', blank=True, null=True)
item_category = models.ForeignKey('ItemCategory', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -144,7 +144,7 @@ class HasItemCategory(models.Model):
class HasItemPocket(models.Model):
item_pocket = models.ForeignKey('ItemPocket', blank=True, null=True)
item_pocket = models.ForeignKey('ItemPocket', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -160,7 +160,7 @@ class HasLanguage(models.Model):
class HasLocation(models.Model):
location = models.ForeignKey('Location', blank = True, null = True)
location = models.ForeignKey('Location', blank = True, null = True, related_name="%(class)s")
class Meta:
abstract = True
@ -168,7 +168,7 @@ class HasLocation(models.Model):
class HasLocationArea(models.Model):
location_area = models.ForeignKey('LocationArea', blank = True, null = True)
location_area = models.ForeignKey('LocationArea', blank = True, null = True, related_name="%(class)s")
class Meta:
abstract = True
@ -192,7 +192,7 @@ class HasMetaCategory(models.Model):
class HasMove(models.Model):
move = models.ForeignKey('Move', blank = True, null = True)
move = models.ForeignKey('Move', blank = True, null = True, related_name="%(class)s")
class Meta:
abstract = True
@ -272,7 +272,7 @@ class HasPokedex(models.Model):
class HasPokemon(models.Model):
pokemon = models.ForeignKey('Pokemon', blank=True, null=True)
pokemon = models.ForeignKey('Pokemon', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -302,9 +302,10 @@ class HasPokemonHabitat(models.Model):
abstract = True
class HasPokemonMoveMethod(models.Model):
#HasPokemonMoveMethod
class HasMoveLearnMethod(models.Model):
pokemon_move_method = models.ForeignKey('PokemonMoveMethod', blank=True, null=True)
move_learn_method = models.ForeignKey('MoveLearnMethod', blank=True, null=True)
class Meta:
abstract = True
@ -412,10 +413,9 @@ class VersionGroup(HasName, HasGeneration, HasOrder):
class VersionGroupRegion(HasVersionGroup, HasRegion):
pass
class VersionGroupPokemonMoveMethod(HasVersionGroup):
pokemon_move_method_id = models.IntegerField()
#VersionGroupPokemonMoveMethod
class VersionGroupMoveLearnMethod(HasVersionGroup, HasMoveLearnMethod):
pass
@ -964,7 +964,9 @@ class MoveTargetDescription(HasMoveTarget, IsDescription, HasName):
# MOVE META MODELS #
######################
class MoveMeta(HasMove, HasMetaAilment, HasMetaCategory):
class MoveMeta(HasMetaAilment, HasMetaCategory):
move = models.OneToOneField(Move, blank = False, null = False, related_name="%(class)s")
min_hits = models.IntegerField(blank = True, null = True)
@ -1253,9 +1255,9 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender):
class PokemonForm(HasName, HasPokemon, HasOrder):
form_identifier = models.CharField(max_length = 30)
form_name = models.CharField(max_length = 30)
introduced_in_version_group = models.ForeignKey(VersionGroup, blank=True, null=True)
version_group = models.ForeignKey(VersionGroup, blank=True, null=True)
is_default = models.BooleanField(default = False)
@ -1293,15 +1295,16 @@ class PokemonItem(HasPokemon, HasVersion, HasItem):
rarity = models.IntegerField()
class PokemonMoveMethod(HasName):
#PokemonMoveMethod
class MoveLearnMethod(HasName):
pass
#PokemonMoveMethodName
class MoveLearnMethodName(IsName, HasMoveLearnMethod, HasDescription):
pass
class PokemonMoveMethodName(IsName, HasPokemonMoveMethod, HasDescription):
pass
class PokemonMove(HasPokemon, HasPokemonMoveMethod, HasVersionGroup, HasMove, HasOrder):
class PokemonMove(HasPokemon, HasMoveLearnMethod, HasVersionGroup, HasMove, HasOrder):
level = models.IntegerField()

View file

@ -216,6 +216,7 @@ class AbilitySummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Ability
fields = ('name', 'url')
class AbilityDetailSerializer(serializers.ModelSerializer):
@ -238,6 +239,25 @@ class AbilityDetailSerializer(serializers.ModelSerializer):
)
######################
# STAT SERIALIZERS #
######################
class StatSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Stat
fields = ('name', 'url')
class StatDetailSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Stat
######################
# TYPE SERIALIZERS #
######################
@ -317,6 +337,166 @@ class TypeDetailSerializer(serializers.ModelSerializer):
###################################
# MOVE DAMAGE CLASS SERIALIZERS #
###################################
class MoveDamageClassDescriptionSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveDamageClassDescription
fields = ('name', 'description', 'language')
class MoveDamageClassSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MoveDamageClass
fields = ('name', 'url')
class MoveDamageClassDetailSerializer(serializers.ModelSerializer):
names = serializers.SerializerMethodField('get_move_damage_class_names')
descriptions = serializers.SerializerMethodField('get_move_damage_class_descriptions')
class Meta:
model = MoveDamageClass
fields = ('id', 'name', 'names', 'descriptions')
def get_move_damage_class_names(self, obj):
move_methods = MoveDamageClassDescription.objects.filter(move_damage_class_id=obj)
serializer = MoveDamageClassDescriptionSerializer(move_methods, many=True, context=self.context)
data = serializer.data
for name in data:
del name['description']
return data
def get_move_damage_class_descriptions(self, obj):
move_methods = MoveDamageClassDescription.objects.filter(move_damage_class_id=obj)
serializer = MoveDamageClassDescriptionSerializer(move_methods, many=True, context=self.context)
data = serializer.data
for name in data:
del name['name']
return data
###########################
# MOVE META SERIALIZERS #
###########################
class MoveMetaAilmentSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MoveMetaAilment
fields = ('name', 'url')
class MoveMetaAilmentDetailSerializer(serializers.ModelSerializer):
class Meta:
model = MoveMetaAilment
class MoveMetaCategorySummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MoveMetaCategory
fields = ('name', 'url')
class MoveMetaCategoryDetailSerializer(serializers.ModelSerializer):
class Meta:
model = MoveMetaCategory
class MoveMetaSerializer(serializers.ModelSerializer):
ailment = MoveMetaAilmentSummarySerializer(source="move_meta_category")
category = MoveMetaCategorySummarySerializer(source="move_meta_category")
class Meta:
model = MoveMeta
fields = (
'ailment',
'category',
'min_hits',
'max_hits',
'min_turns',
'max_turns',
'drain',
'healing',
'crit_rate',
'ailment_chance',
'flinch_chance',
'stat_chance'
)
#############################
# MOVE TARGET SERIALIZERS #
#############################
class MoveTargetDescriptionSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveTargetDescription
fields = ('name', 'description', 'language')
class MoveTargetSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MoveTarget
fields = ('name', 'url')
class MoveTargetDetailSerializer(serializers.ModelSerializer):
names = serializers.SerializerMethodField('get_move_target_names')
descriptions = serializers.SerializerMethodField('get_move_target_descriptions')
class Meta:
model = MoveTarget
fields = ('id', 'name', 'names', 'descriptions')
def get_move_target_names(self, obj):
move_methods = MoveTargetDescription.objects.filter(move_target_id=obj)
serializer = MoveTargetDescriptionSerializer(move_methods, many=True, context=self.context)
data = serializer.data
for name in data:
del name['description']
return data
def get_move_target_descriptions(self, obj):
move_methods = MoveTargetDescription.objects.filter(move_target_id=obj)
serializer = MoveTargetDescriptionSerializer(move_methods, many=True, context=self.context)
data = serializer.data
for name in data:
del name['name']
return data
######################
# MOVE SERIALIZERS #
######################
@ -339,17 +519,51 @@ class MoveSummarySerializer(serializers.HyperlinkedModelSerializer):
class MoveDetailSerializer(serializers.ModelSerializer):
generation = GenerationSummarySerializer()
type = TypeSummarySerializer()
move_target = MoveTargetSummarySerializer()
damage_class = MoveDamageClassSummarySerializer(source="move_damage_class")
meta = MoveMetaSerializer(read_only=True, source="movemeta")
names = MoveNameSerializer(many=True, read_only=True, source="movename")
effect_chance = serializers.IntegerField(source="move_effect_chance")
class Meta:
model = Move
fields = ('id', 'name', 'names')
fields = (
'id',
'name',
'accuracy',
'damage_class',
'effect_chance',
'generation',
'meta',
'move_target',
'names',
'power',
'pp',
'priority',
'type',
)
#########################
# POKEMON SERIALIZERS #
#########################
#################################
# POKEMON ABILITY SERIALIZERS #
#################################
class PokemonAbilitySerializer(serializers.ModelSerializer):
ability = AbilitySummarySerializer()
class Meta:
model = PokemonAbility
fields = ('is_hidden', 'slot', 'ability')
###############################
# POKEMON COLOR SERIALIZERS #
###############################
class PokemonColorNameSerializer(serializers.HyperlinkedModelSerializer):
@ -376,6 +590,83 @@ class PokemonColorDetailSerializer(serializers.ModelSerializer):
fields = ('id', 'name', 'names')
##############################
# POKEMON FORM SERIALIZERS #
##############################
class PokemonFormSerializer(serializers.ModelSerializer):
version_group = VersionGroupSummarySerializer()
class Meta:
model = PokemonForm
# fields = (
# 'form_name',
# 'is_default',
# 'is_battle_only',
# 'is_mega',
# 'form_order',
# 'version_group'
# )
##############################
# POKEMON MOVE SERIALIZERS #
##############################
class MoveLearnMethodSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MoveLearnMethod
fields = ('name', 'url')
class MoveLearnMethodDetailSerializer(serializers.ModelSerializer):
class Meta:
model = MoveLearnMethod
def get_move_method_names(self, obj):
move_methods = MoveLearnMethodName.objects.filter(pokemon_move_method_id=obj)
serializer = MoveLearnMethodNameSerializer(move_methods, many=True, context=self.context)
data = serializer.data
for name in data:
del name['description']
return data
def get_move_method_descriptions(self, obj):
move_methods = MoveLearnMethodName.objects.filter(pokemon_move_method_id=obj)
serializer = MoveLearnMethodNameSerializer(move_methods, many=True, context=self.context)
data = serializer.data
for name in data:
del name['name']
return data
class PokemonMoveSerializer(serializers.ModelSerializer):
# move = MoveSummarySerializer()
# move_method = PokemonMoveMethodSummarySerializer(source="pokemon_move_method")
# version_group = VersionGroupSummarySerializer()
class Meta:
model = PokemonMove
# fields = ('level', 'move_method', 'move', 'version_group')
###############################
# POKEMON SHAPE SERIALIZERS #
###############################
class PokemonShapeNameSerializer(serializers.HyperlinkedModelSerializer):
language = LanguageSummarySerializer()
@ -424,18 +715,10 @@ class PokemonShapeDetailSerializer(serializers.ModelSerializer):
return data
class PokemonSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Pokemon
fields = ('name', 'url')
class PokemonDetailSerializer(serializers.ModelSerializer):
class Meta:
model = Pokemon
#################################
# POKEMON SPECIES SERIALIZERS #
#################################
class PokemonSpeciesNameSerializer(serializers.ModelSerializer):
@ -461,7 +744,7 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer):
growth_rate = GrowthRateSummarySerializer()
pokemon_color = PokemonColorSummarySerializer()
pokemon_shape = PokemonShapeSummarySerializer()
varieties = PokemonDetailSerializer(many=True, read_only=True, source="pokemon")
# varieties = PokemonDetailSerializer(many=True, read_only=True, source="pokemon")
# types = TypeSummarySerializer(many=True, read_only=True, source="pokemonspecies")
class Meta:
@ -487,7 +770,7 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer):
# 'types',
'names',
'genera',
'varieties'
# 'varieties'
)
def get_pokemon_names(self, obj):
@ -518,6 +801,125 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer):
# def get_pokemon_types()
##############################
# POKEMON STAT SERIALIZERS #
##############################
class PokemonStatSerializer(serializers.ModelSerializer):
stat = StatSummarySerializer()
class Meta:
model = PokemonStat
"""
Hiding Pokemon and ID fields
"""
fields = ('base_stat', 'effort', 'stat')
##############################
# POKEMON TYPE SERIALIZERS #
##############################
class PokemonTypeSerializer(serializers.ModelSerializer):
type = TypeSummarySerializer()
class Meta:
model = PokemonType
"""
Hiding Pokemon field
"""
fields = ('slot', 'type')
#########################
# POKEMON SERIALIZERS #
#########################
class PokemonSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Pokemon
fields = ('name', 'url')
class PokemonDetailSerializer(serializers.ModelSerializer):
abilities = PokemonAbilitySerializer(many=True, read_only=True, source="pokemonability")
# moves = PokemonMoveSerializer(many=True, read_only=True, source="pokemonmove")
moves = serializers.SerializerMethodField('get_pokemon_moves')
stats = PokemonStatSerializer(many=True, read_only=True, source="pokemonstat")
types = PokemonTypeSerializer(many=True, read_only=True, source="pokemontype")
# forms = PokemonFormSerializer(many=True, read_only=True, source="pokemonform")
class Meta:
model = Pokemon
fields = (
'id',
'order',
'name',
'is_default',
'height',
'weight',
'base_experience',
'abilities',
'moves',
'stats',
'types'
# 'forms',
)
def get_pokemon_moves(self, obj):
# Doin moves a little differently because pokemon
# move resources are a beast
# Get all possible Version Groups and Move Methods for later use
version_objects = VersionGroup.objects.all()
version_data = VersionGroupSummarySerializer(version_objects, many=True, context=self.context).data
method_objects = MoveLearnMethod.objects.all()
method_data = MoveLearnMethodSummarySerializer(method_objects, many=True, context=self.context).data
# Get moves related to this pokemon and pull out unique Move IDs
pokemon_moves = PokemonMove.objects.filter(pokemon_id=obj).order_by('move_id')
move_ids = pokemon_moves.values('move_id').distinct()
move_list = []
for id in move_ids:
pokemon_move_details = OrderedDict()
# Get each Unique Move by ID
move_object = Move.objects.get(pk=id['move_id'])
move_data = MoveSummarySerializer(move_object, context=self.context).data
pokemon_move_details['move'] = move_data
# Get Versions and Move Methods associated with each unique move
pokemon_move_objects = pokemon_moves.filter(move_id=id['move_id'])
serializer = PokemonMoveSerializer(pokemon_move_objects, many=True, context=self.context)
pokemon_move_details['version_details'] = []
for move in serializer.data:
version_detail = OrderedDict()
version_detail['level_learned_at'] = move['level']
version_detail['version_group'] = version_data[move['version_group'] - 1]
version_detail['move_learn_method'] = method_data[move['move_learn_method'] - 1]
pokemon_move_details['version_details'].append(version_detail)
move_list.append(pokemon_move_details)
return move_list
class PokemonDexNumberSerializer(serializers.ModelSerializer):
entry_number = serializers.IntegerField(source="pokedex_number")
@ -558,11 +960,11 @@ class PokedexDetailSerializer(serializers.ModelSerializer):
region = RegionSummarySerializer()
names = serializers.SerializerMethodField('get_pokedex_names')
descriptions = serializers.SerializerMethodField('get_pokedex_descriptions')
pokemon_entries = serializers.SerializerMethodField('get_pokedex_entries')
# pokemon_entries = serializers.SerializerMethodField('get_pokedex_entries')
class Meta:
model = Pokedex
fields = ('id', 'name', 'is_main_series', 'region', 'names', 'descriptions', 'pokemon_entries')
fields = ('id', 'name', 'is_main_series', 'region', 'names', 'descriptions',)# 'pokemon_entries')
def get_pokedex_names(self, obj):
@ -588,8 +990,6 @@ class PokedexDetailSerializer(serializers.ModelSerializer):
def get_pokedex_entries(self, obj):
print obj
results = PokemonDexNumber.objects.order_by('pokedex_number').filter(pokedex=obj)
serializer = PokemonDexNumberSerializer(results, many=True, context=self.context)
data = serializer.data

View file

@ -93,6 +93,41 @@ class MoveResource(PokeapiCommonViewset):
list_serializer_class = MoveSummarySerializer
class MoveDamageClassResource(PokeapiCommonViewset):
queryset = MoveDamageClass.objects.all()
serializer_class = MoveDamageClassDetailSerializer
list_serializer_class = MoveDamageClassSummarySerializer
class MoveMetaAilmentResource(PokeapiCommonViewset):
queryset = MoveMetaAilment.objects.all()
serializer_class = MoveMetaAilmentDetailSerializer
list_serializer_class = MoveMetaAilmentSummarySerializer
class MoveMetaCategoryResource(PokeapiCommonViewset):
queryset = MoveMetaCategory.objects.all()
serializer_class = MoveMetaCategoryDetailSerializer
list_serializer_class = MoveMetaCategorySummarySerializer
class MoveLearnMethodResource(PokeapiCommonViewset):
queryset = MoveLearnMethod.objects.all()
serializer_class = MoveLearnMethodDetailSerializer
list_serializer_class = MoveLearnMethodSummarySerializer
class MoveTargetResource(PokeapiCommonViewset):
queryset = MoveTarget.objects.all()
serializer_class = MoveTargetDetailSerializer
list_serializer_class = MoveTargetSummarySerializer
class NatureResource(PokeapiCommonViewset):
queryset = Nature.objects.all()
@ -122,9 +157,9 @@ class PokemonShapeResource(PokeapiCommonViewset):
class PokemonResource(PokeapiCommonViewset):
queryset = PokemonSpecies.objects.all()
serializer_class = PokemonSpeciesDetailSerializer
list_serializer_class =PokemonSpeciesSummarySerializer
queryset = Pokemon.objects.all()
serializer_class = PokemonDetailSerializer
list_serializer_class =PokemonSummarySerializer
class RegionResource(PokeapiCommonViewset):
@ -134,6 +169,13 @@ class RegionResource(PokeapiCommonViewset):
list_serializer_class = RegionSummarySerializer
class StatResource(PokeapiCommonViewset):
queryset = Stat.objects.all()
serializer_class = StatDetailSerializer
list_serializer_class = StatSummarySerializer
class TypeResource(PokeapiCommonViewset):
queryset = Type.objects.all()