Merge pull request #62 from zaneadix/tests

Tests done for current api endpoints
This commit is contained in:
Paul Hallett 2015-10-28 10:19:08 +00:00
commit 10d761432a
9 changed files with 3019 additions and 626 deletions

View file

@ -38,6 +38,9 @@ USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Explicitly define test runner to avoid warning messages on test execution
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
MEDIA_ROOT = PROJECT_ROOT.child('media')
MEDIA_URL = '/media/'

View file

@ -57,7 +57,7 @@ router.register(r"generation", GenerationResource)
router.register(r"growth-rate", GrowthRateResource)
router.register(r"item", ItemResource)
router.register(r"item-category", ItemCategoryResource)
router.register(r"item-attribute", ItemFlagResource)
router.register(r"item-attribute", ItemAttributeResource)
router.register(r"item-fling-effect", ItemFlingEffectResource)
router.register(r"item-pocket", ItemPocketResource)
router.register(r"language", LanguageResource)

View file

@ -73,7 +73,7 @@ for index, info in enumerate(data):
languageName = LanguageName (
language = Language.objects.get(pk = int(info[0])),
local_language_id = int(info[1]),
local_language = Language.objects.get(pk = int(info[1])),
name = info[2]
)
@ -224,18 +224,26 @@ for index, info in enumerate(data):
model.save()
clearTable(MoveDamageClassName)
clearTable(MoveDamageClassDescription)
data = loadData('move_damage_class_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveDamageClassDescription (
model_name = MoveDamageClassName (
move_damage_class = MoveDamageClass.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
description = info[2]
name = info[2]
)
model.save()
model_name.save()
model_description = MoveDamageClassDescription (
move_damage_class = MoveDamageClass.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
description = info[3]
)
model_description.save()
###########
@ -334,13 +342,13 @@ for index, info in enumerate(data):
abilityName.save()
clearTable(AbilityDescription)
clearTable(AbilityEffectText)
data = loadData('ability_prose.csv')
for index, info in enumerate(data):
if index > 0:
abilityDesc = AbilityDescription (
abilityDesc = AbilityEffectText (
ability = Ability.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
short_effect = info[2],
@ -512,7 +520,7 @@ for index, info in enumerate(data):
model = ItemFlingEffectDescription (
item_fling_effect = ItemFlingEffect.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
effect = info[2]
description = info[2]
)
model.save()
@ -576,13 +584,13 @@ for index, info in enumerate(data):
model.save()
clearTable(ItemDescription)
clearTable(ItemEffectText)
data = loadData('item_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = ItemDescription (
model = ItemEffectText (
item = Item.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
short_effect = info[2],
@ -620,58 +628,50 @@ for index, info in enumerate(data):
model.save()
clearTable(ItemFlag)
clearTable(ItemAttribute)
data = loadData('item_flags.csv')
for index, info in enumerate(data):
if index > 0:
model = ItemFlag (
model = ItemAttribute (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(ItemFlagDescription)
clearTable(ItemAttributeName)
clearTable(ItemAttributeDescription)
data = loadData('item_flag_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = ItemFlagDescription (
item_flag = ItemFlag.objects.get(pk = int(info[0])),
model_name = ItemAttributeName (
item_attribute = ItemAttribute.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2]
)
model_name.save()
model_description = ItemAttributeDescription (
item_attribute = ItemAttribute.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
model_description.save()
clearTable(ItemFlagMap)
clearTable(ItemAttributeMap)
data = loadData('item_flag_map.csv')
for index, info in enumerate(data):
if index > 0:
model = ItemFlagMap (
model = ItemAttributeMap (
item = Item.objects.get(pk = int(info[0])),
item_flag = ItemFlag.objects.get(pk = int(info[1]))
)
model.save()
clearTable(ItemFlagDescription)
data = loadData('item_flag_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = ItemFlagDescription (
item_flag = ItemFlag.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2],
description = info[3]
item_attribute = ItemAttribute.objects.get(pk = int(info[1]))
)
model.save()
@ -755,13 +755,13 @@ for index, info in enumerate(data):
model.save()
clearTable(MoveEffectDescription)
clearTable(MoveEffectEffectText)
data = loadData('move_effect_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectDescription (
model = MoveEffectEffectText (
move_effect = MoveEffect.objects.get(pk = int(info[1])),
language = Language.objects.get(pk = int(info[1])),
short_effect = info[2],
@ -784,13 +784,13 @@ for index, info in enumerate(data):
model.save()
clearTable(MoveEffectChangeDescription)
clearTable(MoveEffectChangeEffectText)
data = loadData('move_effect_changelog_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectChangeDescription (
model = MoveEffectChangeEffectText (
move_effect_change = MoveEffectChange.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
effect = info[2]
@ -811,18 +811,25 @@ for index, info in enumerate(data):
clearTable(MoveLearnMethodName)
clearTable(MoveLearnMethodDescription)
data = loadData('pokemon_move_method_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveLearnMethodName (
model_name = MoveLearnMethodName (
move_learn_method = MoveLearnMethod.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2]
)
model_name.save()
model_description = MoveLearnMethodDescription (
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()
model_description.save()
clearTable(MoveTarget)
@ -838,19 +845,26 @@ for index, info in enumerate(data):
model.save()
clearTable(MoveTargetName)
clearTable(MoveTargetDescription)
data = loadData('move_target_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveTargetDescription (
model_name = MoveTargetName (
move_target = MoveTarget.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2]
)
model_name.save()
model_description = MoveTargetDescription (
move_target = MoveTarget.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
model_description.save()
clearTable(Move)
@ -969,45 +983,52 @@ for index, info in enumerate(data):
model.save()
clearTable(MoveFlag)
clearTable(MoveAttribute)
data = loadData('move_flags.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlag (
model = MoveAttribute (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveFlagMap)
clearTable(MoveAttributeMap)
data = loadData('move_flag_map.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlagMap (
model = MoveAttributeMap (
move = Move.objects.get(pk = int(info[0])),
move_flag = MoveFlag.objects.get(pk = int(info[1])),
move_attribute = MoveAttribute.objects.get(pk = int(info[1])),
)
model.save()
clearTable(MoveFlagDescription)
clearTable(MoveAttributeName)
clearTable(MoveAttributeDescription)
data = loadData('move_flag_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlagDescription (
move_flag = MoveFlag.objects.get(pk = int(info[0])),
name_model = MoveAttributeName (
move_attribute = MoveAttribute.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2]
)
name_model.save()
description_model = MoveAttributeDescription (
move_attribute = MoveAttribute.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
description_model.save()
clearTable(MoveMetaAilment)
@ -1150,20 +1171,26 @@ for index, info in enumerate(data):
model.save()
clearTable(ContestEffectDescription)
clearTable(ContestEffectEffectText)
data = loadData('contest_effect_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = ContestEffectDescription (
model = ContestEffectEffectText (
contest_effect = ContestEffect.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
flavor_text = info[2],
effect = info[3]
)
model.save()
model = ContestEffectFlavorText (
contest_effect = ContestEffect.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
flavor_text = info[2]
)
model.save()
clearTable(ContestCombo)
data = loadData('contest_combos.csv')
@ -1191,13 +1218,13 @@ for index, info in enumerate(data):
model.save()
clearTable(SuperContestEffectDescription)
clearTable(SuperContestEffectFlavorText)
data = loadData('super_contest_effect_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = SuperContestEffectDescription (
model = SuperContestEffectFlavorText (
super_contest_effect = SuperContestEffect.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
flavor_text = info[2]
@ -1256,9 +1283,12 @@ data = loadData('berries.csv')
for index, info in enumerate(data):
if index > 0:
name = getattr(Item.objects.get(pk = int(info[1])), 'name')
model = Berry (
id = int(info[0]),
item = Item.objects.get(pk = int(info[1])),
name = name[:name.index('-')],
berry_firmness = BerryFirmness.objects.get(pk = int(info[2])),
natural_gift_power = int(info[3]),
nature = None,
@ -1299,10 +1329,10 @@ for index, info in enumerate(data):
nature = Nature (
id = int(info[0]),
name = info[1],
decreased_stat_id = Stat.objects.get(pk = int(info[2])),
increased_stat_id = Stat.objects.get(pk = int(info[3])),
hates_flavor_id = BerryFlavor.objects.get(pk = int(info[4])),
likes_flavor_id = BerryFlavor.objects.get(pk = int(info[5])),
decreased_stat = Stat.objects.get(pk = int(info[2])),
increased_stat = Stat.objects.get(pk = int(info[3])),
hates_flavor = BerryFlavor.objects.get(pk = int(info[4])),
likes_flavor = BerryFlavor.objects.get(pk = int(info[5])),
game_index = info[6]
)
nature.save()
@ -1363,9 +1393,9 @@ for index, info in enumerate(data):
############
# GENDER #
############
###########
# GENDER #
###########
clearTable(Gender)
data = loadData('genders.csv')
@ -1484,19 +1514,26 @@ for index, info in enumerate(data):
model.save()
clearTable(PokedexName)
clearTable(PokedexDescription)
data = loadData('pokedex_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = PokedexDescription (
name_model = PokedexName (
pokedex = Pokedex.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
name = info[2],
)
name_model.save()
description_model = PokedexDescription (
pokedex = Pokedex.objects.get(pk = int(info[0])),
language = Language.objects.get(pk = int(info[1])),
description = info[3]
)
model.save()
description_model.save()
clearTable(PokedexVersionGroup)
@ -1743,7 +1780,7 @@ for index, info in enumerate(data):
evolution_item = Item.objects.get(pk = int(info[3])) if info[3] != '' else None,
min_level = int(info[4]) if info[4] != '' else None,
gender = Gender.objects.get(pk = int(info[5])) if info[5] != '' else None,
location_id = int(info[6]) if info[6] != '' else None,
location = Location.objects.get(pk = int(info[6])) if info[6] != '' else None,
held_item = Item.objects.get(pk = int(info[7])) if info[7] != '' else None,
time_of_day = info[8],
known_move = Move.objects.get(pk = int(info[9])) if info[9] != '' else None,

View file

@ -5,10 +5,10 @@ from .models import *
admin.site.register(Ability)
admin.site.register(AbilityName)
admin.site.register(AbilityDescription)
admin.site.register(AbilityEffectText)
admin.site.register(AbilityFlavorText)
admin.site.register(AbilityChange)
admin.site.register(AbilityChangeDescription)
admin.site.register(AbilityChangeEffectText)
admin.site.register(Berry)
admin.site.register(BerryFirmness)
@ -19,7 +19,8 @@ admin.site.register(Characteristic)
admin.site.register(CharacteristicDescription)
admin.site.register(ContestCombo)
admin.site.register(ContestEffectDescription)
admin.site.register(ContestEffectEffectText)
admin.site.register(ContestEffectFlavorText)
admin.site.register(ContestEffect)
admin.site.register(ContestType)
admin.site.register(ContestTypeName)
@ -53,9 +54,9 @@ admin.site.register(GrowthRateDescription)
admin.site.register(ItemCategory)
admin.site.register(ItemCategoryName)
admin.site.register(ItemFlag)
admin.site.register(ItemFlagMap)
admin.site.register(ItemFlagDescription)
admin.site.register(ItemAttribute)
admin.site.register(ItemAttributeMap)
admin.site.register(ItemAttributeDescription)
admin.site.register(ItemFlavorText)
admin.site.register(ItemFlingEffect)
admin.site.register(ItemFlingEffectDescription)
@ -63,7 +64,7 @@ admin.site.register(ItemGameIndex)
admin.site.register(ItemName)
admin.site.register(ItemPocketName)
admin.site.register(ItemPocket)
admin.site.register(ItemDescription)
admin.site.register(ItemEffectText)
admin.site.register(Item)
admin.site.register(Language)
@ -84,12 +85,13 @@ admin.site.register(MoveChange)
admin.site.register(MoveDamageClass)
admin.site.register(MoveDamageClassDescription)
admin.site.register(MoveEffectChange)
admin.site.register(MoveEffectChangeDescription)
admin.site.register(MoveEffectDescription)
admin.site.register(MoveEffectChangeEffectText)
admin.site.register(MoveEffectEffectText)
admin.site.register(MoveEffect)
admin.site.register(MoveFlagMap)
admin.site.register(MoveFlagDescription)
admin.site.register(MoveFlag)
admin.site.register(MoveAttributeDescription)
admin.site.register(MoveAttributeMap)
admin.site.register(MoveAttributeName)
admin.site.register(MoveAttribute)
admin.site.register(MoveFlavorText)
admin.site.register(MoveLearnMethod)
admin.site.register(MoveLearnMethodName)
@ -152,7 +154,7 @@ admin.site.register(Stat)
admin.site.register(SuperContestEffect)
admin.site.register(SuperContestCombo)
admin.site.register(SuperContestEffectDescription)
admin.site.register(SuperContestEffectFlavorText)
admin.site.register(Type)
admin.site.register(TypeName)

View file

@ -6,7 +6,7 @@ from django.db import models, migrations
class Migration(migrations.Migration):
# replaces = [(b'pokemon_v2', '0001_squashed_0013_auto_20150926_0913'), (b'pokemon_v2', '0002_itemflingeffect_name'), (b'pokemon_v2', '0003_auto_20150928_1710'), (b'pokemon_v2', '0004_auto_20151005_0138')]
# replaces = [(b'pokemon_v2', '0001_squashed_0004_auto_20151005_0138'), (b'pokemon_v2', '0002_auto_20151016_0523'), (b'pokemon_v2', '0003_auto_20151022_1725'), (b'pokemon_v2', '0004_auto_20151022_1729'), (b'pokemon_v2', '0005_auto_20151022_1917'), (b'pokemon_v2', '0006_auto_20151023_0135'), (b'pokemon_v2', '0007_berry_name'), (b'pokemon_v2', '0008_auto_20151023_1735'), (b'pokemon_v2', '0009_auto_20151023_2134'), (b'pokemon_v2', '0010_auto_20151024_0252'), (b'pokemon_v2', '0011_auto_20151024_0322'), (b'pokemon_v2', '0012_auto_20151024_0340'), (b'pokemon_v2', '0013_auto_20151024_0345'), (b'pokemon_v2', '0014_auto_20151024_0350'), (b'pokemon_v2', '0015_auto_20151024_0434'), (b'pokemon_v2', '0016_auto_20151024_1942'), (b'pokemon_v2', '0017_auto_20151024_2015'), (b'pokemon_v2', '0018_auto_20151024_2021'), (b'pokemon_v2', '0019_auto_20151024_2030'), (b'pokemon_v2', '0020_auto_20151024_2200'), (b'pokemon_v2', '0021_auto_20151025_1634'), (b'pokemon_v2', '0022_auto_20151025_1725'), (b'pokemon_v2', '0023_auto_20151025_1910'), (b'pokemon_v2', '0024_auto_20151027_0023')]
dependencies = [
]
@ -30,7 +30,6 @@ class Migration(migrations.Migration):
name='LanguageName',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('local_language_id', models.IntegerField()),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='languagename_language', blank=True, to='pokemon_v2.Language', null=True)),
],
@ -75,19 +74,6 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AbilityDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('short_effect', models.CharField(max_length=300)),
('effect', models.CharField(max_length=4000)),
('ability', models.ForeignKey(blank=True, to='pokemon_v2.Ability', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AbilityFlavorText',
fields=[
@ -155,7 +141,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='versionname_language', blank=True, to='pokemon_v2.Language', null=True)),
('version', models.ForeignKey(blank=True, to='pokemon_v2.Version', null=True)),
('version', models.ForeignKey(related_name='versionname', blank=True, to='pokemon_v2.Version', null=True)),
],
options={
'abstract': False,
@ -262,7 +248,7 @@ class Migration(migrations.Migration):
('move_battle_style_id', models.IntegerField()),
('low_hp_preference', models.IntegerField()),
('high_hp_preference', models.IntegerField()),
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
('nature', models.ForeignKey(related_name='naturebattlestylepreference', blank=True, to='pokemon_v2.Nature', null=True)),
],
options={
'abstract': False,
@ -289,7 +275,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='statname_language', blank=True, to='pokemon_v2.Language', null=True)),
('stat', models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True)),
('stat', models.ForeignKey(related_name='statname', blank=True, to='pokemon_v2.Stat', null=True)),
],
options={
'abstract': False,
@ -318,7 +304,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='naturename_language', blank=True, to='pokemon_v2.Language', null=True)),
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
('nature', models.ForeignKey(related_name='naturename', blank=True, to='pokemon_v2.Nature', null=True)),
],
options={
'abstract': False,
@ -486,9 +472,8 @@ 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)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='movedamageclassdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_damage_class', models.ForeignKey(blank=True, to='pokemon_v2.MoveDamageClass', null=True)),
('move_damage_class', models.ForeignKey(related_name='movedamageclassdescription', blank=True, to='pokemon_v2.MoveDamageClass', null=True)),
],
options={
'abstract': False,
@ -509,7 +494,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('move_effect', models.ForeignKey(blank=True, to='pokemon_v2.MoveEffect', null=True)),
('version_group', models.ForeignKey(blank=True, to='pokemon_v2.VersionGroup', null=True)),
('version_group', models.ForeignKey(related_name='moveeffectchange', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
'abstract': False,
@ -517,63 +502,10 @@ class Migration(migrations.Migration):
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveEffectChangeDescription',
name='MoveAttribute',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('language', models.ForeignKey(related_name='moveeffectchangedescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_effect_change', models.ForeignKey(blank=True, to='pokemon_v2.MoveEffectChange', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveEffectDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('short_effect', models.CharField(max_length=300)),
('effect', models.CharField(max_length=4000)),
('language', models.ForeignKey(related_name='moveeffectdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_effect', models.ForeignKey(blank=True, to='pokemon_v2.MoveEffect', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveFlag',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=30)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveFlagDescription',
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='moveflagdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_flag', models.ForeignKey(blank=True, to='pokemon_v2.MoveFlag', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveFlagMap',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=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={
'abstract': False,
@ -631,7 +563,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='movemetaailmentname_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_meta_ailment', models.ForeignKey(blank=True, to='pokemon_v2.MoveMetaAilment', null=True)),
('move_meta_ailment', models.ForeignKey(related_name='movemetaailmentname', blank=True, to='pokemon_v2.MoveMetaAilment', null=True)),
],
options={
'abstract': False,
@ -655,7 +587,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.CharField(default='', max_length=1000)),
('language', models.ForeignKey(related_name='movemetacategorydescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_meta_category', models.ForeignKey(blank=True, to='pokemon_v2.MoveMetaCategory', null=True)),
('move_meta_category', models.ForeignKey(related_name='movemetacategorydescription', blank=True, to='pokemon_v2.MoveMetaCategory', null=True)),
],
options={
'abstract': False,
@ -668,7 +600,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('change', models.IntegerField()),
('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)),
('stat', models.ForeignKey(related_name='movemetastatchange', blank=True, to='pokemon_v2.Stat', null=True)),
],
options={
'abstract': False,
@ -704,9 +636,8 @@ 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)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='movetargetdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_target', models.ForeignKey(blank=True, to='pokemon_v2.MoveTarget', null=True)),
('move_target', models.ForeignKey(related_name='movetargetdescription', blank=True, to='pokemon_v2.MoveTarget', null=True)),
],
options={
'abstract': False,
@ -716,7 +647,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='movemeta',
name='move_meta_category',
field=models.ForeignKey(blank=True, to='pokemon_v2.MoveMetaCategory', null=True),
field=models.ForeignKey(related_name='movemeta', blank=True, to='pokemon_v2.MoveMetaCategory', null=True),
preserve_default=True,
),
migrations.AddField(
@ -728,7 +659,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='movemeta',
name='move_meta_ailment',
field=models.ForeignKey(blank=True, to='pokemon_v2.MoveMetaAilment', null=True),
field=models.ForeignKey(related_name='movemeta', blank=True, to='pokemon_v2.MoveMetaAilment', null=True),
preserve_default=True,
),
migrations.AddField(
@ -905,12 +836,6 @@ class Migration(migrations.Migration):
field=models.CharField(max_length=40),
preserve_default=True,
),
migrations.AlterField(
model_name='moveflag',
name='name',
field=models.CharField(max_length=40),
preserve_default=True,
),
migrations.AlterField(
model_name='movemetaailment',
name='name',
@ -1013,12 +938,6 @@ class Migration(migrations.Migration):
field=models.CharField(max_length=100),
preserve_default=True,
),
migrations.AlterField(
model_name='moveflag',
name='name',
field=models.CharField(max_length=100),
preserve_default=True,
),
migrations.AlterField(
model_name='movemetaailment',
name='name',
@ -1203,20 +1122,7 @@ class Migration(migrations.Migration):
name='AbilityChange',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('ability', models.ForeignKey(blank=True, to='pokemon_v2.Ability', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AbilityChangeDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('ability_change', models.ForeignKey(blank=True, to='pokemon_v2.AbilityChange', null=True)),
('language', models.ForeignKey(related_name='abilitychangedescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('ability', models.ForeignKey(related_name='abilitychange', blank=True, to='pokemon_v2.Ability', null=True)),
],
options={
'abstract': False,
@ -1299,7 +1205,6 @@ 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)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='pokedexdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('pokedex', models.ForeignKey(related_name='pokedexdescription', blank=True, to='pokemon_v2.Pokedex', null=True)),
],
@ -1367,7 +1272,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='pokemoncolorname_language', blank=True, to='pokemon_v2.Language', null=True)),
('pokemon_color', models.ForeignKey(blank=True, to='pokemon_v2.PokemonColor', null=True)),
('pokemon_color', models.ForeignKey(related_name='pokemoncolorname', blank=True, to='pokemon_v2.PokemonColor', null=True)),
],
options={
'abstract': False,
@ -1443,7 +1348,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='pokemonformgeneration', blank=True, to='pokemon_v2.Generation', null=True)),
('pokemon_form', models.ForeignKey(blank=True, to='pokemon_v2.PokemonForm', null=True)),
('pokemon_form', models.ForeignKey(related_name='pokemonformgeneration', blank=True, to='pokemon_v2.PokemonForm', null=True)),
],
options={
'abstract': False,
@ -1457,7 +1362,7 @@ class Migration(migrations.Migration):
('name', models.CharField(max_length=100)),
('pokemon_name', models.CharField(max_length=30)),
('language', models.ForeignKey(related_name='pokemonformname_language', blank=True, to='pokemon_v2.Language', null=True)),
('pokemon_form', models.ForeignKey(blank=True, to='pokemon_v2.PokemonForm', null=True)),
('pokemon_form', models.ForeignKey(related_name='pokemonformname', blank=True, to='pokemon_v2.PokemonForm', null=True)),
],
options={
'abstract': False,
@ -1544,10 +1449,9 @@ class Migration(migrations.Migration):
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='movelearnmethodname_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_learn_method', models.ForeignKey(blank=True, to='pokemon_v2.MoveLearnMethod', null=True)),
('move_learn_method', models.ForeignKey(related_name='movelearnmethodname', blank=True, to='pokemon_v2.MoveLearnMethod', null=True)),
],
options={
'abstract': False,
@ -1653,7 +1557,7 @@ class Migration(migrations.Migration):
('base_stat', models.IntegerField()),
('effort', models.IntegerField()),
('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)),
('stat', models.ForeignKey(related_name='pokemonstat', blank=True, to='pokemon_v2.Stat', null=True)),
],
options={
'abstract': False,
@ -1789,11 +1693,9 @@ class Migration(migrations.Migration):
model_name='pokemonevolution',
name='held_item_id',
),
migrations.AlterField(
migrations.RemoveField(
model_name='pokemonevolution',
name='location_id',
field=models.IntegerField(null=True, blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonevolution',
@ -1924,21 +1826,7 @@ class Migration(migrations.Migration):
bases=(models.Model,),
),
migrations.CreateModel(
name='ItemDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('short_effect', models.CharField(max_length=300)),
('item', models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True)),
('language', models.ForeignKey(related_name='itemdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ItemFlag',
name='ItemAttribute',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
@ -1948,32 +1836,6 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ItemFlagDescription',
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)),
('item_flag', models.ForeignKey(blank=True, to='pokemon_v2.ItemFlag', null=True)),
('language', models.ForeignKey(related_name='itemflagdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ItemFlagMap',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=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={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ItemFlavorText',
fields=[
@ -2001,9 +1863,9 @@ class Migration(migrations.Migration):
name='ItemFlingEffectDescription',
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(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)),
('description', models.CharField(default='', max_length=1000)),
],
options={
'abstract': False,
@ -2140,7 +2002,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)),
('berry_firmness', models.ForeignKey(blank=True, to='pokemon_v2.BerryFirmness', null=True)),
('berry_firmness', models.ForeignKey(related_name='berryfirmnessname', blank=True, to='pokemon_v2.BerryFirmness', null=True)),
('language', models.ForeignKey(related_name='berryfirmnessname_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
@ -2182,20 +2044,6 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ContestEffectDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('flavor_text', models.CharField(max_length=500)),
('contest_effect', models.ForeignKey(blank=True, to='pokemon_v2.ContestEffect', null=True)),
('language', models.ForeignKey(related_name='contesteffectdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ContestType',
fields=[
@ -2243,27 +2091,31 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='berry',
name='nature',
field=models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True),
field=models.ForeignKey(related_name='berry', blank=True, to='pokemon_v2.Nature', null=True),
preserve_default=True,
),
migrations.RenameField(
model_name='nature',
old_name='hates_flavor_id',
new_name='hates_flavor',
),
migrations.AlterField(
model_name='nature',
name='hates_flavor_id',
name='hates_flavor',
field=models.ForeignKey(related_name='hates_flavor', blank=True, to='pokemon_v2.BerryFlavor', null=True),
preserve_default=True,
),
migrations.RenameField(
model_name='nature',
old_name='likes_flavor_id',
new_name='likes_flavor',
),
migrations.AlterField(
model_name='nature',
name='likes_flavor_id',
name='likes_flavor',
field=models.ForeignKey(related_name='likes_flavor', blank=True, to='pokemon_v2.BerryFlavor', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='abilitydescription',
name='language',
field=models.ForeignKey(related_name='abilitydescription_language', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.CreateModel(
name='Region',
fields=[
@ -2599,19 +2451,6 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.CreateModel(
name='SuperContestEffectDescription',
fields=[
('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='supercontesteffectdescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('super_contest_effect', models.ForeignKey(blank=True, to='pokemon_v2.SuperContestEffect', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.AddField(
model_name='palpark',
name='pal_park_area',
@ -2636,42 +2475,12 @@ class Migration(migrations.Migration):
field=models.IntegerField(null=True, blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='abilitydescription',
name='ability',
field=models.ForeignKey(related_name='descriptions', blank=True, to='pokemon_v2.Ability', null=True),
preserve_default=True,
),
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='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',
@ -2744,12 +2553,6 @@ class Migration(migrations.Migration):
field=models.ForeignKey(related_name='move', blank=True, to='pokemon_v2.Type', 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='pokemonitem',
name='version',
@ -2895,14 +2698,14 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='pokemonmove',
name='move_learn_method',
field=models.ForeignKey(blank=True, to='pokemon_v2.MoveLearnMethod', null=True),
field=models.ForeignKey(related_name='pokemonmove', 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)),
('move_learn_method', models.ForeignKey(related_name='versiongroupmovelearnmethod', blank=True, to='pokemon_v2.MoveLearnMethod', null=True)),
('version_group', models.ForeignKey(related_name='versiongroupmovelearnmethod', blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
@ -2916,4 +2719,321 @@ class Migration(migrations.Migration):
field=models.CharField(default='name', max_length=100),
preserve_default=False,
),
migrations.CreateModel(
name='ItemAttributeDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.CharField(default='', max_length=1000)),
('item_attribute', models.ForeignKey(related_name='itemattributedescription', blank=True, to='pokemon_v2.ItemAttribute', null=True)),
('language', models.ForeignKey(related_name='itemattributedescription_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ItemAttributeMap',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('item', models.ForeignKey(related_name='itemattributemap', blank=True, to='pokemon_v2.Item', null=True)),
('item_attribute', models.ForeignKey(related_name='itemattributemap', blank=True, to='pokemon_v2.ItemAttribute', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.AddField(
model_name='berry',
name='name',
field=models.CharField(default='name', max_length=100),
preserve_default=False,
),
migrations.AddField(
model_name='languagename',
name='local_language',
field=models.ForeignKey(related_name='locallanguage', blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='naturepokeathlonstat',
name='nature',
field=models.ForeignKey(related_name='naturepokeathlonstat', blank=True, to='pokemon_v2.Nature', null=True),
preserve_default=True,
),
migrations.CreateModel(
name='ItemAttributeName',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('item_attribute', models.ForeignKey(related_name='itemattributename', blank=True, to='pokemon_v2.ItemAttribute', null=True)),
('language', models.ForeignKey(related_name='itemattributename_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveAttributeDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.CharField(default='', max_length=1000)),
('language', models.ForeignKey(related_name='moveattributedescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_attribute', models.ForeignKey(blank=True, to='pokemon_v2.MoveAttribute', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveAttributeMap',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('move', models.ForeignKey(related_name='moveattributemap', blank=True, to='pokemon_v2.Move', null=True)),
('move_attribute', models.ForeignKey(blank=True, to='pokemon_v2.MoveAttribute', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveAttributeName',
fields=[
('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='moveattributename_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_attribute', models.ForeignKey(blank=True, to='pokemon_v2.MoveAttribute', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveDamageClassName',
fields=[
('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='movedamageclassname_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_damage_class', models.ForeignKey(related_name='movedamageclassname', blank=True, to='pokemon_v2.MoveDamageClass', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveTargetName',
fields=[
('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='movetargetname_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_target', models.ForeignKey(related_name='movetargetname', blank=True, to='pokemon_v2.MoveTarget', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='PokedexName',
fields=[
('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='pokedexname_language', blank=True, to='pokemon_v2.Language', null=True)),
('pokedex', models.ForeignKey(related_name='pokedexname', blank=True, to='pokemon_v2.Pokedex', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveLearnMethodDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.CharField(default='', max_length=1000)),
('language', models.ForeignKey(related_name='movelearnmethoddescription_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_learn_method', models.ForeignKey(related_name='movelearnmethoddescription', blank=True, to='pokemon_v2.MoveLearnMethod', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.AlterField(
model_name='move',
name='move_damage_class',
field=models.ForeignKey(related_name='move', blank=True, to='pokemon_v2.MoveDamageClass', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='stat',
name='move_damage_class',
field=models.ForeignKey(related_name='stat', blank=True, to='pokemon_v2.MoveDamageClass', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='type',
name='move_damage_class',
field=models.ForeignKey(related_name='type', blank=True, to='pokemon_v2.MoveDamageClass', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='move',
name='move_target',
field=models.ForeignKey(related_name='move', blank=True, to='pokemon_v2.MoveTarget', null=True),
preserve_default=True,
),
migrations.CreateModel(
name='AbilityChangeEffectText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('ability_change', models.ForeignKey(blank=True, to='pokemon_v2.AbilityChange', null=True)),
('language', models.ForeignKey(related_name='abilitychangeeffecttext_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AbilityEffectText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('short_effect', models.CharField(max_length=300)),
('ability', models.ForeignKey(related_name='abilityeffecttext', blank=True, to='pokemon_v2.Ability', null=True)),
('language', models.ForeignKey(related_name='abilityeffecttext_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ItemEffectText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('short_effect', models.CharField(max_length=300)),
('item', models.ForeignKey(related_name='itemeffecttext', blank=True, to='pokemon_v2.Item', null=True)),
('language', models.ForeignKey(related_name='itemeffecttext_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ContestEffectEffectText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('contest_effect', models.ForeignKey(related_name='contesteffecteffecttext', blank=True, to='pokemon_v2.ContestEffect', null=True)),
('language', models.ForeignKey(related_name='contesteffecteffecttext_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveEffectChangeEffectText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('language', models.ForeignKey(related_name='moveeffectchangeeffecttext_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_effect_change', models.ForeignKey(blank=True, to='pokemon_v2.MoveEffectChange', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MoveEffectEffectText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('effect', models.CharField(max_length=4000)),
('short_effect', models.CharField(max_length=300)),
('language', models.ForeignKey(related_name='moveeffecteffecttext_language', blank=True, to='pokemon_v2.Language', null=True)),
('move_effect', models.ForeignKey(blank=True, to='pokemon_v2.MoveEffect', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='SuperContestEffectFlavorText',
fields=[
('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='supercontesteffectflavortext_language', blank=True, to='pokemon_v2.Language', null=True)),
('super_contest_effect', models.ForeignKey(blank=True, to='pokemon_v2.SuperContestEffect', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ContestEffectFlavorText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('flavor_text', models.CharField(max_length=500)),
('contest_effect', models.ForeignKey(related_name='contesteffectflavortext', blank=True, to='pokemon_v2.ContestEffect', null=True)),
('language', models.ForeignKey(related_name='contesteffectflavortext_language', blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.AlterField(
model_name='characteristic',
name='stat',
field=models.ForeignKey(related_name='characteristic', blank=True, to='pokemon_v2.Stat', null=True),
preserve_default=True,
),
migrations.RenameField(
model_name='nature',
old_name='decreased_stat_id',
new_name='decreased_stat',
),
migrations.RenameField(
model_name='nature',
old_name='increased_stat_id',
new_name='increased_stat',
),
migrations.AlterField(
model_name='pokemonspecies',
name='pokemon_color',
field=models.ForeignKey(related_name='pokemonspecies', blank=True, to='pokemon_v2.PokemonColor', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspecies',
name='pokemon_shape',
field=models.ForeignKey(related_name='pokemonspecies', blank=True, to='pokemon_v2.PokemonShape', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='pokemonevolution',
name='location',
field=models.ForeignKey(related_name='location', blank=True, to='pokemon_v2.Location', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspecies',
name='pokemon_shape',
field=models.ForeignKey(blank=True, to='pokemon_v2.PokemonShape', null=True),
preserve_default=True,
),
]

View file

@ -134,6 +134,14 @@ class HasItem(models.Model):
abstract = True
class HasItemAttribute(models.Model):
item_attribute = models.ForeignKey('ItemAttribute', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
class HasItemCategory(models.Model):
item_category = models.ForeignKey('ItemCategory', blank=True, null=True, related_name="%(class)s")
@ -176,7 +184,7 @@ class HasLocationArea(models.Model):
class HasMetaAilment(models.Model):
move_meta_ailment = models.ForeignKey('MoveMetaAilment', blank = True, null = True)
move_meta_ailment = models.ForeignKey('MoveMetaAilment', blank = True, null = True, related_name="%(class)s")
class Meta:
abstract = True
@ -184,7 +192,7 @@ class HasMetaAilment(models.Model):
class HasMetaCategory(models.Model):
move_meta_category = models.ForeignKey('MoveMetaCategory', blank = True, null = True)
move_meta_category = models.ForeignKey('MoveMetaCategory', blank = True, null = True, related_name="%(class)s")
class Meta:
abstract = True
@ -200,7 +208,7 @@ class HasMove(models.Model):
class HasMoveDamageClass(models.Model):
move_damage_class = models.ForeignKey('MoveDamageClass', blank = True, null = True)
move_damage_class = models.ForeignKey('MoveDamageClass', blank = True, null = True, related_name="%(class)s")
class Meta:
abstract = True
@ -214,9 +222,9 @@ class HasMoveEffect(models.Model):
abstract = True
class HasMoveFlag(models.Model):
class HasMoveAttribute(models.Model):
move_flag = models.ForeignKey('MoveFlag', blank = True, null = True)
move_attribute = models.ForeignKey('MoveAttribute', blank = True, null = True)
class Meta:
abstract = True
@ -224,7 +232,7 @@ class HasMoveFlag(models.Model):
class HasMoveTarget(models.Model):
move_target = models.ForeignKey('MoveTarget', blank = True, null = True)
move_target = models.ForeignKey('MoveTarget', blank = True, null = True, related_name="%(class)s")
class Meta:
abstract = True
@ -240,7 +248,7 @@ class HasName(models.Model):
class HasNature(models.Model):
nature = models.ForeignKey('Nature', blank=True, null=True)
nature = models.ForeignKey('Nature', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -280,7 +288,7 @@ class HasPokemon(models.Model):
class HasPokemonColor(models.Model):
pokemon_color = models.ForeignKey('PokemonColor', blank=True, null=True)
pokemon_color = models.ForeignKey('PokemonColor', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -288,7 +296,7 @@ class HasPokemonColor(models.Model):
class HasPokemonForm(models.Model):
pokemon_form = models.ForeignKey('PokemonForm', blank=True, null=True)
pokemon_form = models.ForeignKey('PokemonForm', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -296,7 +304,7 @@ class HasPokemonForm(models.Model):
class HasPokemonHabitat(models.Model):
pokemon_habitat = models.ForeignKey('PokemonHabitat', blank=True, null=True)
pokemon_habitat = models.ForeignKey('PokemonHabitat', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -305,7 +313,7 @@ class HasPokemonHabitat(models.Model):
#HasPokemonMoveMethod
class HasMoveLearnMethod(models.Model):
move_learn_method = models.ForeignKey('MoveLearnMethod', blank=True, null=True)
move_learn_method = models.ForeignKey('MoveLearnMethod', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -313,7 +321,7 @@ class HasMoveLearnMethod(models.Model):
class HasPokemonShape(models.Model):
pokemon_shape = models.ForeignKey('PokemonShape', blank=True, null=True)
pokemon_shape = models.ForeignKey('PokemonShape', blank=True, null=True, )
class Meta:
abstract = True
@ -345,7 +353,7 @@ class HasShortEffect(models.Model):
class HasStat(models.Model):
stat = models.ForeignKey('Stat', blank=True, null=True)
stat = models.ForeignKey('Stat', blank=True, null=True, related_name="%(class)s")
class Meta:
abstract = True
@ -401,9 +409,8 @@ class Version(HasName, HasVersionGroup):
pass
class VersionName(IsName):
version = models.ForeignKey('Version', blank=True, null=True)
class VersionName(IsName, HasVersion):
pass
class VersionGroup(HasName, HasGeneration, HasOrder):
@ -434,7 +441,7 @@ class Language(HasName, HasOrder):
class LanguageName(IsName):
local_language_id = models.IntegerField()
local_language = models.ForeignKey('Language', blank = True, null = True, related_name="locallanguage")
@ -473,7 +480,7 @@ class Ability(HasName, HasGeneration):
is_main_series = models.BooleanField(default = False)
class AbilityDescription(HasLanguage, HasEffect, HasShortEffect, HasAbility):
class AbilityEffectText(HasLanguage, HasEffect, HasShortEffect, HasAbility):
pass
@ -489,7 +496,7 @@ class AbilityChange(HasAbility):
pass
class AbilityChangeDescription(HasLanguage, HasEffect):
class AbilityChangeEffectText(HasLanguage, HasEffect):
ability_change = models.ForeignKey(AbilityChange, blank=True, null=True)
@ -588,7 +595,7 @@ class ItemFlingEffect(HasName):
pass
class ItemFlingEffectDescription(HasFlingEffect, HasLanguage, HasEffect):
class ItemFlingEffectDescription(IsDescription, HasFlingEffect):
pass
@ -599,9 +606,8 @@ class Item(HasName, HasItemCategory, HasFlingEffect):
fling_power = models.IntegerField(blank=True, null=True)
class ItemDescription(HasLanguage, HasEffect, HasShortEffect):
item = models.ForeignKey(Item, blank=True, null=True)
class ItemEffectText(HasItem, HasLanguage, HasEffect, HasShortEffect):
pass
class ItemName(HasItem, IsName):
@ -612,18 +618,20 @@ class ItemFlavorText(HasItem, HasVersionGroup, IsFlavorText):
pass
class ItemFlag(HasName):
class ItemAttribute(HasName):
pass
class ItemFlagDescription(IsDescription, HasName):
item_flag = models.ForeignKey(ItemFlag, blank=True, null=True)
class ItemAttributeName(IsName, HasItemAttribute):
pass
class ItemFlagMap(HasItem):
class ItemAttributeDescription(IsDescription, HasItemAttribute):
pass
item_flag = models.ForeignKey(ItemFlag, blank=True, null=True)
class ItemAttributeMap(HasItem, HasItemAttribute):
pass
class ItemGameIndex(HasItem, HasGeneration, HasGameIndex):
@ -653,9 +661,14 @@ class ContestEffect(models.Model):
jam = models.IntegerField()
class ContestEffectDescription(HasLanguage, HasEffect, HasFlavorText):
class ContestEffectEffectText(HasLanguage, HasEffect):
contest_effect = models.ForeignKey(ContestEffect, blank=True, null=True)
contest_effect = models.ForeignKey(ContestEffect, blank=True, null=True, related_name="%(class)s")
class ContestEffectFlavorText(HasLanguage, HasFlavorText):
contest_effect = models.ForeignKey(ContestEffect, blank=True, null=True, related_name="%(class)s")
class ContestCombo(models.Model):
@ -676,10 +689,10 @@ class BerryFirmness(HasName):
class BerryFirmnessName(IsName):
berry_firmness = models.ForeignKey(BerryFirmness, blank=True, null=True)
berry_firmness = models.ForeignKey(BerryFirmness, blank=True, null=True, related_name="%(class)s")
class Berry(HasItem, HasNature):
class Berry(HasName, HasItem, HasNature):
berry_firmness = models.ForeignKey(BerryFirmness, blank=True, null=True)
@ -724,13 +737,13 @@ class GrowthRateDescription(HasGrowthRate, IsDescription):
class Nature(HasName):
decreased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'decreased')
decreased_stat = models.ForeignKey(Stat, blank = True, null = True, related_name = 'decreased')
increased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'increased')
increased_stat = models.ForeignKey(Stat, blank = True, null = True, related_name = 'increased')
hates_flavor_id = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'hates_flavor')
hates_flavor = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'hates_flavor')
likes_flavor_id = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'likes_flavor')
likes_flavor = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'likes_flavor')
game_index = models.IntegerField()
@ -888,8 +901,10 @@ class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect):
class MoveDamageClass(HasName):
pass
class MoveDamageClassName(HasMoveDamageClass, IsName):
pass
class MoveDamageClassDescription(HasMoveDamageClass, IsDescription, HasName):
class MoveDamageClassDescription(HasMoveDamageClass, IsDescription):
pass
@ -916,7 +931,7 @@ class MoveEffect(models.Model):
pass
class MoveEffectDescription(HasLanguage, HasMoveEffect, HasEffect, HasShortEffect):
class MoveEffectEffectText(HasLanguage, HasMoveEffect, HasEffect, HasShortEffect):
pass
@ -924,25 +939,29 @@ class MoveEffectChange(HasMoveEffect, HasVersionGroup):
pass
class MoveEffectChangeDescription(HasLanguage, HasEffect):
class MoveEffectChangeEffectText(HasLanguage, HasEffect):
move_effect_change = models.ForeignKey('MoveEffectChange', blank = True, null = True)
######################
# MOVE FLAG MODELS #
######################
################################
# MOVE FLAG/ATTRIBUTE MODELS #
################################
class MoveFlag(HasName):
class MoveAttribute(HasName):
pass
class MoveFlagDescription(HasMoveFlag, HasName, IsDescription):
class MoveAttributeName(HasMoveAttribute, IsName):
pass
class MoveFlagMap(HasMove, HasMoveFlag):
class MoveAttributeDescription(HasMoveAttribute, IsDescription):
pass
class MoveAttributeMap(HasMove, HasMoveAttribute):
pass
@ -955,7 +974,11 @@ class MoveTarget(HasName):
pass
class MoveTargetDescription(HasMoveTarget, IsDescription, HasName):
class MoveTargetName(HasMoveTarget, IsName):
pass
class MoveTargetDescription(HasMoveTarget, IsDescription):
pass
@ -1091,7 +1114,7 @@ class SuperContestEffect(models.Model):
appeal = models.IntegerField()
class SuperContestEffectDescription(IsFlavorText):
class SuperContestEffectFlavorText(IsFlavorText):
super_contest_effect = models.ForeignKey(SuperContestEffect, blank = True, null = True)
@ -1131,7 +1154,11 @@ class Pokedex(HasName, HasRegion):
is_main_series = models.BooleanField(default = False)
class PokedexDescription(HasPokedex, HasName, IsDescription):
class PokedexName(HasPokedex, IsName):
pass
class PokedexDescription(HasPokedex, IsDescription):
pass
@ -1224,7 +1251,7 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender):
min_level = models.IntegerField(blank=True, null=True)
location_id = models.IntegerField(blank=True, null=True) # need location tables
location = models.ForeignKey(Location, related_name="location", blank=True, null=True)
held_item = models.ForeignKey(Item, blank=True, null=True, related_name='held_item')
@ -1300,7 +1327,11 @@ class MoveLearnMethod(HasName):
pass
#PokemonMoveMethodName
class MoveLearnMethodName(IsName, HasMoveLearnMethod, HasDescription):
class MoveLearnMethodName(IsName, HasMoveLearnMethod):
pass
class MoveLearnMethodDescription(IsDescription, HasMoveLearnMethod):
pass

View file

@ -78,10 +78,10 @@ class ItemCategorySummarySerializer(serializers.HyperlinkedModelSerializer):
model = ItemCategory
fields = ('name', 'url')
class ItemFlagSummarySerializer(serializers.HyperlinkedModelSerializer):
class ItemAttributeSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = ItemFlag
model = ItemAttribute
fields = ('name', 'url')
class ItemFlingEffectSummarySerializer(serializers.HyperlinkedModelSerializer):
@ -110,20 +110,10 @@ class BerryFirmnessSummarySerializer(serializers.HyperlinkedModelSerializer):
class BerrySummarySerializer(serializers.HyperlinkedModelSerializer):
name = serializers.SerializerMethodField('get_berry_name')
class Meta:
model = Berry
fields = ('url', 'name')
def get_berry_name(self,obj):
item = Item.objects.get(id=obj.item.id)
serializer = ItemSummarySerializer(item, context=self.context)
name = serializer.data['name']
return name[:name.index('-')]
class EggGroupSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
@ -241,11 +231,11 @@ class PokemonFormSummarySerializer(serializers.HyperlinkedModelSerializer):
class LanguageNameSerializer(serializers.ModelSerializer):
local_language_url = serializers.HyperlinkedRelatedField(read_only='True', source="local_language_id", view_name='language-detail')
language = LanguageSummarySerializer(source="local_language")
class Meta:
model = LanguageName
fields = ('name', 'local_language_url')
fields = ('name', 'language')
class LanguageDetailSerializer(serializers.ModelSerializer):
@ -254,7 +244,7 @@ class LanguageDetailSerializer(serializers.ModelSerializer):
class Meta:
model = Language
fields = ('name', 'official', 'iso639', 'iso3166', 'id', 'names')
fields = ('id', 'name', 'official', 'iso639', 'iso3166', 'names')
@ -357,11 +347,11 @@ class VersionDetailSerializer(serializers.ModelSerializer):
"""
names = VersionNameSerializer(many=True, read_only=True, source="versionname")
version_group_url = serializers.HyperlinkedRelatedField(read_only='True', source="version_group", view_name='versiongroup-detail')
version_group = VersionGroupSummarySerializer()
class Meta:
model = Version
fields = ('id', 'name', 'names', 'version_group_url')
fields = ('id', 'name', 'names', 'version_group')
class VersionGroupDetailSerializer(serializers.ModelSerializer):
@ -403,12 +393,12 @@ class LocationDetailSerializer(serializers.ModelSerializer):
# ABILITY SERIALIZERS #
#########################
class AbilityDescriptionSerializer(serializers.ModelSerializer):
class AbilityEffectTextSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = AbilityDescription
model = AbilityEffectText
fields = ('effect', 'short_effect', 'language')
@ -434,7 +424,7 @@ class AbilityNameSerializer(serializers.ModelSerializer):
class AbilityDetailSerializer(serializers.ModelSerializer):
descriptions = AbilityDescriptionSerializer(many=True, read_only=True, source="abilitydescription")
effect_text_entries = AbilityEffectTextSerializer(many=True, read_only=True, source="abilityeffecttext")
flavor_text_entries = AbilityFlavorTextSerializer(many=True, read_only=True, source="abilityflavortext")
names = AbilityNameSerializer(many=True, read_only=True, source="abilityname")
generation = GenerationSummarySerializer()
@ -447,7 +437,7 @@ class AbilityDetailSerializer(serializers.ModelSerializer):
'is_main_series',
'generation',
'names',
'descriptions',
'effect_text_entries',
'flavor_text_entries'
)
@ -457,10 +447,23 @@ class AbilityDetailSerializer(serializers.ModelSerializer):
# STAT SERIALIZERS #
######################
class StatDetailSerializer(serializers.HyperlinkedModelSerializer):
class StatNameSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = StatName
fields = ('name', 'language')
class StatDetailSerializer(serializers.ModelSerializer):
names = StatNameSerializer(many=True, read_only=True, source="statname")
move_damage_class = MoveDamageClassSummarySerializer()
class Meta:
model = Stat
fields = ('id', 'name', 'game_index', 'is_battle_only', 'move_damage_class', 'names')
@ -510,74 +513,56 @@ class ItemCategoryDetailSerializer(serializers.ModelSerializer):
fields = ('id', 'name', 'pocket', 'names')
###########################
# ITEM FLAG SERIALIZERS #
###########################
################################
# ITEM ATTRIBUTE SERIALIZERS #
################################
# Calling these Attributes instead of Flags cause I think that just makes more sense
# Probably should change the names of the models as well. Work To Do.
class ItemFlagDescriptionSerializer(serializers.ModelSerializer):
class ItemAttributeNameSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = ItemFlagDescription
fields = ('name', 'description', 'language')
model = ItemAttributeName
fields = ('name', 'language')
class ItemFlagDetailSerializer(serializers.ModelSerializer):
class ItemAttributeDescriptionSerializer(serializers.ModelSerializer):
names = serializers.SerializerMethodField('get_flag_names')
descriptions = serializers.SerializerMethodField('get_flag_descriptions')
language = LanguageSummarySerializer()
class Meta:
model = ItemFlag
model = ItemAttributeDescription
fields = ('description', 'language')
class ItemAttributeDetailSerializer(serializers.ModelSerializer):
names = ItemAttributeNameSerializer(many=True, read_only=True, source="itemattributename")
descriptions = ItemAttributeDescriptionSerializer(many=True, read_only=True, source="itemattributedescription")
class Meta:
model = ItemAttribute
fields = ('id', 'name', 'names', 'descriptions')
def get_flag_names(self, obj):
item_flag = ItemFlagDescription.objects.filter(item_flag_id=obj)
serializer = ItemFlagDescriptionSerializer(item_flag, many=True, context=self.context)
data = serializer.data
class ItemAttributeMapSerializer(serializers.ModelSerializer):
print data
for flag in data:
del flag['description']
return data
def get_flag_descriptions(self, obj):
item_flag = ItemFlagDescription.objects.filter(item_flag_id=obj)
serializer = ItemFlagDescriptionSerializer(item_flag, many=True, context=self.context)
data = serializer.data
for flag in data:
del flag['name']
return data
class ItemFlagMapSerializer(serializers.ModelSerializer):
attribute = ItemFlagSummarySerializer(source='item_flag')
item = ItemSummarySerializer()
attribute = ItemAttributeSummarySerializer(source='item_attribute')
class Meta:
model = ItemFlagMap
fields = ('attribute',)
model = ItemAttributeMap
fields = ('item', 'attribute',)
###########################
# ITEM FLAG SERIALIZERS #
###########################
###################################
# ITEM FLING EFFECT SERIALIZERS #
###################################
class ItemFlingEffectDescriptionSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
description = serializers.CharField(source="effect")
class Meta:
model = ItemFlingEffectDescription
@ -586,7 +571,7 @@ class ItemFlingEffectDescriptionSerializer(serializers.ModelSerializer):
class ItemFlingEffectDetailSerializer(serializers.ModelSerializer):
descriptions = ItemCategoryNameSerializer(many=True, read_only=True, source="itemflingeffectdescription")
descriptions = ItemFlingEffectDescriptionSerializer(many=True, read_only=True, source="itemflingeffectdescription")
class Meta:
model = ItemFlingEffect
@ -609,12 +594,12 @@ class ItemFlavorTextSerializer(serializers.ModelSerializer):
fields = ('text', 'version_group', 'language')
class ItemDescriptionSerializer(serializers.ModelSerializer):
class ItemEffectTextSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = ItemDescription
model = ItemEffectText
fields = ('effect', 'short_effect', 'language')
@ -630,10 +615,10 @@ class ItemNameSerializer(serializers.ModelSerializer):
class ItemDetailSerializer(serializers.ModelSerializer):
names = ItemNameSerializer(many=True, read_only=True, source="itemname")
descriptions = ItemDescriptionSerializer(many=True, read_only=True, source="itemdescription")
effect_text_entries = ItemEffectTextSerializer(many=True, read_only=True, source="itemeffecttext")
flavor_text_entries = ItemFlavorTextSerializer(many=True, read_only=True, source="itemflavortext")
category = ItemCategorySummarySerializer(source="item_category")
attributes = ItemFlagMapSerializer(many=True, read_only=True, source="itemflagmap")
attributes = serializers.SerializerMethodField("get_item_attributes")
fling_effect = ItemFlingEffectSummarySerializer(source="item_fling_effect")
class Meta:
@ -647,10 +632,26 @@ class ItemDetailSerializer(serializers.ModelSerializer):
'category',
'attributes',
'names',
'descriptions',
'flavor_text_entries'
'effect_text_entries',
'flavor_text_entries',
)
def get_item_attributes(self, obj):
item_attribute_maps = ItemAttributeMap.objects.filter(item=obj)
serializer = ItemAttributeMapSerializer(item_attribute_maps, many=True, context=self.context)
data = serializer.data
attributes = []
for map in data:
attribute = OrderedDict()
attribute['name'] = map['attribute']['name']
attribute['url'] = map['attribute']['url']
attributes.append(attribute)
return attributes
########################
@ -659,20 +660,24 @@ class ItemDetailSerializer(serializers.ModelSerializer):
class NatureNameSerializer(serializers.ModelSerializer):
name = LanguageSummarySerializer()
language = LanguageSummarySerializer()
class Meta:
model = NatureName
fields = ('description', 'language')
fields = ('name', 'language')
class NatureDetailSerializer(serializers.ModelSerializer):
# NEED FLAVORS
names = NatureNameSerializer(many=True, read_only=True, source="naturename")
decreased_stat = StatSummarySerializer()
increased_stat = StatSummarySerializer()
class Meta:
model = Nature
fields = ('id', 'name', 'names')
fields = ('id', 'name', 'names', 'decreased_stat', 'increased_stat')
@ -701,7 +706,6 @@ class BerryFirmnessDetailSerializer(serializers.ModelSerializer):
class BerryDetailSerializer(serializers.ModelSerializer):
item = ItemSummarySerializer()
name = serializers.SerializerMethodField('get_berry_name')
nature = NatureSummarySerializer()
nature_power = serializers.IntegerField(source='natural_gift_power')
firmness = BerryFirmnessSummarySerializer(source="berry_firmness")
@ -722,14 +726,6 @@ class BerryDetailSerializer(serializers.ModelSerializer):
'soil_dryness'
)
def get_berry_name(self,obj):
item = Item.objects.get(id=obj.item.id)
serializer = ItemSummarySerializer(item, context=self.context)
name = serializer.data['name']
return name[:name.index('-')]
###########################
@ -801,6 +797,7 @@ class TypeDetailSerializer(serializers.ModelSerializer):
"""
generation = GenerationSummarySerializer()
names = AbilityNameSerializer(many=True, read_only=True, source="typename")
move_damage_class = MoveDamageClassSummarySerializer()
damage_relations = serializers.SerializerMethodField('get_type_relationships')
class Meta:
@ -852,67 +849,78 @@ class TypeDetailSerializer(serializers.ModelSerializer):
# MOVE DAMAGE CLASS SERIALIZERS #
###################################
class MoveDamageClassNameSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveDamageClassName
fields = ('name', 'language')
class MoveDamageClassDescriptionSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveDamageClassDescription
fields = ('name', 'description', 'language')
fields = ('description', 'language')
class MoveDamageClassDetailSerializer(serializers.ModelSerializer):
names = serializers.SerializerMethodField('get_move_damage_class_names')
descriptions = serializers.SerializerMethodField('get_move_damage_class_descriptions')
names = MoveDamageClassNameSerializer(many=True, read_only=True, source="movedamageclassname")
descriptions = MoveDamageClassDescriptionSerializer(many=True, read_only=True, source="movedamageclassdescription")
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 MoveMetaAilmentNameSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveMetaAilmentName
fields = ('name', 'language')
class MoveMetaAilmentDetailSerializer(serializers.ModelSerializer):
names = MoveMetaAilmentNameSerializer(many=True, read_only=True, source="movemetaailmentname")
class Meta:
model = MoveMetaAilment
fields = ('id', 'name', 'names')
class MoveMetaCategoryDescriptionSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveMetaCategoryDescription
fields = ('description', 'language')
class MoveMetaCategoryDetailSerializer(serializers.ModelSerializer):
descriptions = MoveMetaCategoryDescriptionSerializer(many=True, read_only=True, source="movemetacategorydescription")
class Meta:
model = MoveMetaCategory
fields = ('id', 'name', 'descriptions')
class MoveMetaSerializer(serializers.ModelSerializer):
ailment = MoveMetaAilmentSummarySerializer(source="move_meta_category")
ailment = MoveMetaAilmentSummarySerializer(source="move_meta_ailment")
category = MoveMetaCategorySummarySerializer(source="move_meta_category")
class Meta:
@ -938,46 +946,33 @@ class MoveMetaSerializer(serializers.ModelSerializer):
# MOVE TARGET SERIALIZERS #
#############################
class MoveTargetNameSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveTargetName
fields = ('name', 'language')
class MoveTargetDescriptionSerializer(serializers.ModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveTargetDescription
fields = ('name', 'description', 'language')
fields = ('description', 'language')
class MoveTargetDetailSerializer(serializers.ModelSerializer):
names = serializers.SerializerMethodField('get_move_target_names')
descriptions = serializers.SerializerMethodField('get_move_target_descriptions')
names = MoveTargetNameSerializer(many=True, read_only=True, source="movetargetname")
descriptions = MoveTargetDescriptionSerializer(many=True, read_only=True, source="movetargetdescription")
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
######################
@ -997,7 +992,7 @@ class MoveDetailSerializer(serializers.ModelSerializer):
generation = GenerationSummarySerializer()
type = TypeSummarySerializer()
move_target = MoveTargetSummarySerializer()
target = MoveTargetSummarySerializer(source="move_target")
damage_class = MoveDamageClassSummarySerializer(source="move_damage_class")
meta = MoveMetaSerializer(read_only=True, source="movemeta")
names = MoveNameSerializer(many=True, read_only=True, source="movename")
@ -1013,7 +1008,7 @@ class MoveDetailSerializer(serializers.ModelSerializer):
'effect_chance',
'generation',
'meta',
'move_target',
'target',
'names',
'power',
'pp',
@ -1112,32 +1107,33 @@ class PokemonHabitatDetailSerializer(serializers.ModelSerializer):
# POKEMON MOVE SERIALIZERS #
##############################
class MoveLearnMethodNameSerializer(serializers.HyperlinkedModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveLearnMethodName
fields = ('name', 'language')
class MoveLearnMethodDescriptionSerializer(serializers.HyperlinkedModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = MoveLearnMethodDescription
fields = ('description', 'language')
class MoveLearnMethodDetailSerializer(serializers.ModelSerializer):
names = MoveLearnMethodNameSerializer(many=True, read_only=True, source="movelearnmethodname")
descriptions = MoveLearnMethodDescriptionSerializer(many=True, read_only=True, source="movelearnmethoddescription")
class Meta:
model = MoveLearnMethod
fields = ('id', 'name', 'names', 'descriptions')
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):
@ -1303,8 +1299,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer):
for move in serializer.data:
print move
version_detail = OrderedDict()
version_detail['level_learned_at'] = move['level']
@ -1346,8 +1340,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer):
for item in serializer.data:
print item
version_detail = OrderedDict()
version_detail['rarity'] = item['rarity']
@ -1517,6 +1509,7 @@ class PokemonEvolutionSerializer(serializers.ModelSerializer):
party_species = PokemonSpeciesSummarySerializer()
party_type = TypeSummarySerializer()
trade_species = PokemonSpeciesSummarySerializer()
location = LocationSummarySerializer()
trigger = EvolutionTriggerSummarySerializer(source="evolution_trigger")
class Meta:
@ -1528,7 +1521,7 @@ class PokemonEvolutionSerializer(serializers.ModelSerializer):
'held_item',
'known_move',
'known_move_type',
'location_id',
'location',
'min_level',
'min_happiness',
'min_beauty',
@ -1581,8 +1574,10 @@ class EvolutionChainDetailSerializer(serializers.ModelSerializer):
entry = OrderedDict()
evolution_object = PokemonEvolution.objects.filter(evolved_species=species['id'])
evolution_data = PokemonEvolutionSerializer(evolution_object, many=True, context=self.context).data
evolution_object = PokemonEvolution.objects.get(evolved_species=species['id'])
evolution_data = PokemonEvolutionSerializer(evolution_object, context=self.context).data
print evolution_data
current_evolutions.append(entry)
@ -1615,13 +1610,22 @@ class PokemonDexNumberSerializer(serializers.ModelSerializer):
# POKEDEX SERIALIZERS #
#########################
class PokedexNameSerializer(serializers.HyperlinkedModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = PokedexName
fields = ('name', 'language')
class PokedexDescriptionSerializer(serializers.HyperlinkedModelSerializer):
language = LanguageSummarySerializer()
class Meta:
model = PokedexDescription
fields = ('name', 'description', 'language')
fields = ('description', 'language')
class PokedexDetailSerializer(serializers.ModelSerializer):
@ -1632,35 +1636,13 @@ class PokedexDetailSerializer(serializers.ModelSerializer):
"""
region = RegionSummarySerializer()
names = serializers.SerializerMethodField('get_pokedex_names')
descriptions = serializers.SerializerMethodField('get_pokedex_descriptions')
names = PokedexNameSerializer(many=True, read_only=True, source="pokedexname")
descriptions = PokedexDescriptionSerializer(many=True, read_only=True, source="pokedexdescription")
# pokemon_entries = serializers.SerializerMethodField('get_pokedex_entries')
class Meta:
model = Pokedex
fields = ('id', 'name', 'is_main_series', 'region', 'names', 'descriptions',)# 'pokemon_entries')
def get_pokedex_names(self, obj):
results = PokedexDescription.objects.filter(pokedex_id=obj)
serializer = PokedexDescriptionSerializer(results, many=True, context=self.context)
data = serializer.data
for name in data:
del name['description']
return data
def get_pokedex_descriptions(self, obj):
results = PokedexDescription.objects.filter(pokedex_id=obj)
serializer = PokedexDescriptionSerializer(results, many=True, context=self.context)
data = serializer.data
for name in data:
del name['name']
return data
fields = ('id', 'name', 'is_main_series', 'region', 'names', 'descriptions',)
def get_pokedex_entries(self, obj):

File diff suppressed because it is too large Load diff

View file

@ -129,11 +129,11 @@ class ItemCategoryResource(PokeapiCommonViewset):
list_serializer_class = ItemCategorySummarySerializer
class ItemFlagResource(PokeapiCommonViewset):
class ItemAttributeResource(PokeapiCommonViewset):
queryset = ItemFlag.objects.all()
serializer_class = ItemFlagDetailSerializer
list_serializer_class = ItemFlagSummarySerializer
queryset = ItemAttribute.objects.all()
serializer_class = ItemAttributeDetailSerializer
list_serializer_class = ItemAttributeSummarySerializer
class ItemFlingEffectResource(PokeapiCommonViewset):