Merge branch 'master' into rest-framework

Conflicts:
	config/settings.py
	pokemon_v2/admin.py
	pokemon_v2/models.py
This commit is contained in:
phalt 2015-04-11 11:05:59 +01:00
commit ba049cc936
8 changed files with 2703 additions and 24 deletions

5
.gitignore vendored
View file

@ -1,6 +1,7 @@
*.pyc
*/media/*
*/static/*
*media/*
*static/*
*build/*
*.DS_STORE
db.*
venv*

View file

@ -19,7 +19,7 @@ import os
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = ".settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pokeapi.config.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION

View file

@ -0,0 +1 @@
from build import *

850
data/v2/build.py Normal file
View file

@ -0,0 +1,850 @@
import csv
import os
from django.db import migrations
from pokemon_v2.models import *
data_location = 'data/v2/csv/'
# migrations.RunSQL('INSERT INTO pokemon_v2_statname VALUES name=banana')
def loadData(fileName):
return csv.reader(open(data_location + fileName, 'rb'), delimiter=',')
def clearTable(model):
print str(model)
model.objects.all().delete()
def parseNumber(num):
try:
result = int(num)
except ValueError:
result = ''
return result
##############
# LANGUAGE #
##############
clearTable(Language)
data = loadData('languages.csv')
for index, info in enumerate(data):
if index > 0:
language = Language (
id = int(info[0]),
iso639 = info[1],
iso3166 = info[2],
name = info[3],
official = bool(info[4]),
order = info[5],
)
language.save()
clearTable(LanguageName)
data = loadData('language_names.csv')
for index, info in enumerate(data):
if index > 0:
languageName = LanguageName (
language = Language.objects.get(id = int(info[0])),
local_language_id = int(info[1]),
name = info[2]
)
languageName.save()
################
# GENERATION #
################
clearTable(Generation)
data = loadData('generations.csv')
for index, info in enumerate(data):
if index > 0:
generation = Generation (
id = int(info[0]),
main_region_id = info[1],
name = info[2]
)
generation.save()
clearTable(GenerationName)
data = loadData('generation_names.csv')
for index, info in enumerate(data):
if index > 0:
generationName = GenerationName (
generation = Generation.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
generationName.save()
#############
# VERSION #
#############
clearTable(VersionGroup)
data = loadData('version_groups.csv')
for index, info in enumerate(data):
if index > 0:
versionGroup = VersionGroup (
id = int(info[0]),
name = info[1],
generation = Generation.objects.get(id = int(info[2])),
order = int(info[3])
)
versionGroup.save()
clearTable(VersionGroupRegion)
data = loadData('version_group_regions.csv')
for index, info in enumerate(data):
if index > 0:
versionGroupRegion = VersionGroupRegion (
version_group = VersionGroup.objects.get(id = int(info[0])),
region_id = int(info[1])
)
versionGroupRegion.save()
clearTable(Version)
data = loadData('versions.csv')
for index, info in enumerate(data):
if index > 0:
version = Version (
id = int(info[0]),
version_group = VersionGroup.objects.get(id = int(info[1])),
name = info[2]
)
version.save()
clearTable(VersionName)
data = loadData('version_names.csv')
for index, info in enumerate(data):
if index > 0:
versionName = VersionName (
version = Version.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
versionName.save()
# ##################
# # DAMAGE CLASS #
# ##################
clearTable(MoveDamageClass)
data = loadData('move_damage_classes.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveDamageClass (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveDamageClassDescription)
data = loadData('move_damage_class_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveDamageClassDescription (
move_damage_class = MoveDamageClass.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
###########
# STATS #
###########
clearTable(Stat)
data = loadData('stats.csv')
for index, info in enumerate(data):
if index > 0:
stat = Stat (
id = int(info[0]),
move_damage_class = MoveDamageClass.objects.get(id = int(info[1])) if info[1] != '' else None,
name = info[2],
is_battle_only = bool(info[3]),
game_index = int(info[4]) if info[4] else 0,
)
stat.save()
clearTable(StatName)
data = loadData('stat_names.csv')
for index, info in enumerate(data):
if index > 0:
statName = StatName (
stat = Stat.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
statName.save()
###############
# ABILITIES #
###############
clearTable(Ability)
data = loadData('abilities.csv')
for index, info in enumerate(data):
if index > 0:
ability = Ability (
id = int(info[0]),
name = info[1],
generation = Generation.objects.get(id = int(info[2])),
is_main_series = bool(info[3])
)
ability.save()
clearTable(AbilityName)
data = loadData('ability_names.csv')
for index, info in enumerate(data):
if index > 0:
abilityName = AbilityName (
ability = Ability.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
abilityName.save()
clearTable(AbilityDescription)
data = loadData('ability_prose.csv')
for index, info in enumerate(data):
if index > 0:
abilityDesc = AbilityDescription (
ability = Ability.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
short_effect = info[2],
effect = info[3]
)
abilityDesc.save()
clearTable(AbilityFlavorText)
data = loadData('ability_flavor_text.csv')
for index, info in enumerate(data):
if index > 0:
abilityFlavorText = AbilityFlavorText (
ability = Ability.objects.get(id = int(info[0])),
version_group = VersionGroup.objects.get(id = int(info[1])),
language = Language.objects.get(id = int(info[2])),
flavor_text = info[3]
)
abilityFlavorText.save()
####################
# CHARACTERISTIC #
####################
clearTable(Characteristic)
data = loadData('characteristics.csv')
for index, info in enumerate(data):
if index > 0:
model = Characteristic (
id = int(info[0]),
stat = Stat.objects.get(id = int(info[1])),
gene_mod_5 = int(info[2])
)
model.save()
clearTable(CharacteristicDescription)
data = loadData('characteristic_text.csv')
for index, info in enumerate(data):
if index > 0:
model = CharacteristicDescription (
characteristic = Characteristic.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
###############
# EGG GROUP #
###############
clearTable(EggGroup)
data = loadData('egg_groups.csv')
for index, info in enumerate(data):
if index > 0:
model = EggGroup (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(EggGroupName)
data = loadData('egg_group_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = EggGroupName (
egg_group = EggGroup.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
#################
# GROWTH RATE #
#################
clearTable(GrowthRate)
data = loadData('growth_rates.csv')
for index, info in enumerate(data):
if index > 0:
model = GrowthRate (
id = int(info[0]),
name = info[1],
formula = info[2]
)
model.save()
clearTable(GrowthRateDescription)
data = loadData('growth_rate_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = GrowthRateDescription (
growth_rate = GrowthRate.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
############
# NATURE #
############
clearTable(Nature)
data = loadData('natures.csv')
for index, info in enumerate(data):
if index > 0:
nature = Nature (
id = int(info[0]),
name = info[1],
decreased_stat_id = Stat.objects.get(id = int(info[2])),
increased_stat_id = Stat.objects.get(id = int(info[3])),
hates_flavor_id = info[4],
likes_flavor_id = info[5],
game_index = info[6]
)
nature.save()
clearTable(NatureName)
data = loadData('nature_names.csv')
for index, info in enumerate(data):
if index > 0:
natureName = NatureName (
nature = Nature.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
natureName.save()
clearTable(NaturePokeathlonStat)
data = loadData('nature_pokeathlon_stats.csv')
for index, info in enumerate(data):
if index > 0:
naturePokeathlonStat = NaturePokeathlonStat (
nature = Nature.objects.get(id = int(info[0])),
pokeathlon_stat_id = Stat.objects.get(id = int(info[1])),
max_change = info[2]
)
naturePokeathlonStat.save()
clearTable(NatureBattleStylePreference)
data = loadData('nature_battle_style_preferences.csv')
for index, info in enumerate(data):
if index > 0:
model = NatureBattleStylePreference (
nature = Nature.objects.get(id = int(info[0])),
move_battle_style_id = int(info[1]),
low_hp_preference = info[2],
high_hp_preference = info[3]
)
model.save()
###########
# TYPES #
###########
clearTable(Type)
data = loadData('types.csv')
for index, info in enumerate(data):
if index > 0:
type = Type (
id = int(info[0]),
name = info[1],
generation = Generation.objects.get(id = int(info[2])),
move_damage_class = MoveDamageClass.objects.get(id = int(info[3])) if info[3] != '' else None
)
type.save()
clearTable(TypeName)
data = loadData('type_names.csv')
for index, info in enumerate(data):
if index > 0:
typeName = TypeName (
type = Type.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
typeName.save()
clearTable(TypeGameIndex)
data = loadData('type_game_indices.csv')
for index, info in enumerate(data):
if index > 0:
typeGameIndex = TypeGameIndex (
type = Type.objects.get(id = int(info[0])),
generation = Generation.objects.get(id = int(info[1])),
game_index = int(info[2])
)
typeGameIndex.save()
clearTable(TypeEfficacy)
data = loadData('type_efficacy.csv')
for index, info in enumerate(data):
if index > 0:
typeEfficacy = TypeEfficacy (
damage_type_id = int(info[0]),
target_type_id = int(info[1]),
damage_factor = int(info[2])
)
typeEfficacy.save()
# ###########
# # MOVES #
# ###########
clearTable(MoveEffect)
data = loadData('move_effects.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffect (
id = int(info[0])
)
model.save()
clearTable(MoveEffectDescription)
data = loadData('move_effect_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectDescription (
move_effect = MoveEffect.objects.get(id = int(info[1])),
language = Language.objects.get(id = int(info[1])),
short_effect = info[2],
effect = info[3]
)
model.save()
clearTable(MoveEffectChange)
data = loadData('move_effect_changelog.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectChange (
id = int(info[0]),
move_effect = MoveEffect.objects.get(id = int(info[1])),
version_group = VersionGroup.objects.get(id = int(info[2]))
)
model.save()
clearTable(MoveEffectChangeDescription)
data = loadData('move_effect_changelog_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectChangeDescription (
move_effect_change = MoveEffectChange.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
effect = info[2]
)
model.save()
clearTable(MoveTarget)
data = loadData('move_targets.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveTarget (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveTargetDescription)
data = loadData('move_target_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveTargetDescription (
move_target = MoveTarget.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
clearTable(Move)
data = loadData('moves.csv')
for index, info in enumerate(data):
if index > 0:
model = Move (
id = int(info[0]),
name = info[1],
generation = Generation.objects.get(id = int(info[2])),
type = Type.objects.get(id = int(info[3])),
power = int(info[4]) if info[4] != '' else None,
pp = int(info[5]) if info[5] != '' else None,
accuracy = int(info[6]) if info[6] != '' else None,
priority = int(info[7]) if info[7] != '' else None,
move_target = MoveTarget.objects.get(id = int(info[8])),
move_damage_class = MoveDamageClass.objects.get(id = int(info[9])),
move_effect = MoveEffect.objects.get(id = int(info[10])),
move_effect_chance = int(info[11]) if info[11] != '' else None,
contest_type_id = int(info[12]) if info[12] != '' else None,
contest_effect_id = int(info[13]) if info[13] != '' else None,
super_contest_effect_id = int(info[14]) if info[14] != '' else None
)
model.save()
clearTable(MoveName)
data = loadData('move_names.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveName (
move = Move.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
clearTable(MoveFlavorText)
data = loadData('move_flavor_text.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlavorText (
move = Move.objects.get(id = int(info[0])),
version_group = VersionGroup.objects.get(id = int(info[1])),
language = Language.objects.get(id = int(info[2])),
flavor_text = info[3]
)
model.save()
clearTable(MoveChange)
data = loadData('move_changelog.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveChange (
move = Move.objects.get(id = int(info[0])),
version_group = VersionGroup.objects.get(id = int(info[1])),
type = Type.objects.get(id = int(info[2])) if info[2] != '' else None,
power = int(info[3]) if info[3] != '' else None,
pp = int(info[4]) if info[4] != '' else None,
accuracy = int(info[5]) if info[5] != '' else None,
move_effect = MoveEffect.objects.get(id = int(info[6])) if info[6] != '' else None,
move_effect_chance = int(info[7]) if info[7] != '' else None
)
model.save()
clearTable(MoveBattleStyle)
data = loadData('move_battle_styles.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveBattleStyle (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveBattleStyleName)
data = loadData('move_battle_style_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveBattleStyleName (
move_battle_style = MoveBattleStyle.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
clearTable(MoveFlag)
data = loadData('move_flags.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlag (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveFlagMap)
data = loadData('move_flag_map.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlagMap (
move = Move.objects.get(id = int(info[0])),
move_flag = MoveFlag.objects.get(id = int(info[1])),
)
model.save()
clearTable(MoveFlagDescription)
data = loadData('move_flag_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlagDescription (
move_flag = MoveFlag.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
clearTable(MoveMetaAilment)
data = loadData('move_meta_ailments.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaAilment (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveMetaAilmentName)
data = loadData('move_meta_ailment_names.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaAilmentName (
move_meta_ailment = MoveMetaAilment.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
clearTable(MoveMetaCategory)
data = loadData('move_meta_categories.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaCategory (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveMetaCategoryDescription)
data = loadData('move_meta_category_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaCategoryDescription (
move_meta_category = MoveMetaCategory.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
clearTable(MoveMeta)
data = loadData('move_meta.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMeta (
move = Move.objects.get(id = int(info[0])),
move_meta_category = MoveMetaCategory.objects.get(id = int(info[1])),
move_meta_ailment = MoveMetaAilment.objects.get(id = int(info[2])),
min_hits = int(info[3]) if info[3] != '' else None,
max_hits = int(info[4]) if info[4] != '' else None,
min_turns = int(info[5]) if info[5] != '' else None,
max_turns = int(info[6]) if info[6] != '' else None,
drain = int(info[7]) if info[7] != '' else None,
healing = int(info[8]) if info[8] != '' else None,
crit_rate = int(info[9]) if info[9] != '' else None,
ailment_chance = int(info[10]) if info[10] != '' else None,
flinch_chance = int(info[11]) if info[11] != '' else None,
stat_chance = int(info[12]) if info[12] != '' else None,
)
model.save()
clearTable(MoveMetaStatChange)
data = loadData('move_meta_stat_changes.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaStatChange (
move = Move.objects.get(id = int(info[0])),
stat = Stat.objects.get(id = int(info[1])),
change = int(info[2])
)
model.save()

21
pokemon_v2/admin.py Normal file
View file

@ -0,0 +1,21 @@
from __future__ import unicode_literals
from django.contrib import admin
from .models import *
admin.site.register(Language)
admin.site.register(LanguageName)
admin.site.register(Generation)
admin.site.register(GenerationName)
admin.site.register(Version)
admin.site.register(VersionName)
admin.site.register(VersionGroup)
admin.site.register(VersionGroupRegion)
admin.site.register(VersionGroupPokemonMoveMethod)
admin.site.register(Ability)
admin.site.register(AbilityName)
admin.site.register(AbilityDescription)
admin.site.register(AbilityFlavorText)

File diff suppressed because it is too large Load diff

591
pokemon_v2/models.py Normal file
View file

@ -0,0 +1,591 @@
from __future__ import unicode_literals
from django.db import models
#####################
# ABSTRACT MODELS #
#####################
class HasAbility(models.Model):
ability = models.ForeignKey('Ability', blank=True, null=True)
class Meta:
abstract = True
class HasCharacteristic(models.Model):
characteristic = models.ForeignKey('Characteristic', blank=True, null=True)
class Meta:
abstract = True
class HasDescription(models.Model):
description = models.CharField(max_length=200, default='')
class Meta:
abstract = True
class HasEggGroup(models.Model):
egg_group = models.ForeignKey('EggGroup', blank=True, null=True)
class Meta:
abstract = True
class HasFlavorText(models.Model):
flavor_text = models.CharField(max_length=200)
class Meta:
abstract = True
class HasGameIndex(models.Model):
game_index = models.IntegerField()
class Meta:
abstract = True
class HasGeneration(models.Model):
generation = models.ForeignKey('Generation', blank=True, null=True)
class Meta:
abstract = True
class HasGrowthRate(models.Model):
growth_rate = models.ForeignKey('GrowthRate', blank=True, null=True)
class Meta:
abstract = True
class HasLanguage(models.Model):
language = models.ForeignKey('Language', blank = True, null = True)
class Meta:
abstract = True
class HasMetaAilment(models.Model):
move_meta_ailment = models.ForeignKey('MoveMetaAilment', blank = True, null = True)
class Meta:
abstract = True
class HasMetaCategory(models.Model):
move_meta_category = models.ForeignKey('MoveMetaCategory', blank = True, null = True)
class Meta:
abstract = True
class HasMove(models.Model):
move = models.ForeignKey('Move', blank = True, null = True)
class Meta:
abstract = True
class HasMoveDamageClass(models.Model):
move_damage_class = models.ForeignKey('MoveDamageClass', blank = True, null = True)
class Meta:
abstract = True
class HasMoveEffect(models.Model):
move_effect = models.ForeignKey('MoveEffect', blank = True, null = True)
class Meta:
abstract = True
class HasMoveFlag(models.Model):
move_flag = models.ForeignKey('MoveFlag', blank = True, null = True)
class Meta:
abstract = True
class HasMoveTarget(models.Model):
move_target = models.ForeignKey('MoveTarget', blank = True, null = True)
class Meta:
abstract = True
class HasName(models.Model):
name = models.CharField(max_length=100)
class Meta:
abstract = True
class HasNature(models.Model):
nature = models.ForeignKey('Nature', blank=True, null=True)
class Meta:
abstract = True
class HasOrder(models.Model):
order = models.IntegerField()
class Meta:
abstract = True
class HasStat(models.Model):
stat = models.ForeignKey('Stat', blank=True, null=True)
class Meta:
abstract = True
class HasType(models.Model):
type = models.ForeignKey('Type', blank=True, null=True)
class Meta:
abstract = True
class HasVersionGroup(models.Model):
version_group = models.ForeignKey('VersionGroup', blank=True, null=True)
class Meta:
abstract = True
class IsName(HasLanguage, HasName):
class Meta:
abstract = True
class IsDescription(HasLanguage, HasDescription):
class Meta:
abstract = True
class IsEffectDescription(HasLanguage):
short_effect = models.CharField(max_length=300)
effect = models.CharField(max_length=4000)
class Meta:
abstract = True
class IsName(HasLanguage, HasName):
class Meta:
abstract = True
class IsFlavorText(HasLanguage, HasFlavorText):
class Meta:
abstract = True
####################
# VERSION MODELS #
####################
class Version(HasName, HasVersionGroup):
pass
class VersionName(IsName):
version = models.ForeignKey('Version', blank=True, null=True)
class VersionGroup(HasName, HasGeneration, HasOrder):
pass
class VersionGroupRegion(HasVersionGroup):
region_id = models.IntegerField()
class VersionGroupPokemonMoveMethod(HasVersionGroup):
pokemon_move_method_id = models.IntegerField()
#####################
# LANGUAGE MODELS #
#####################
class Language(HasName, HasOrder):
iso639 = models.CharField(max_length=2)
iso3166 = models.CharField(max_length=2)
official = models.BooleanField(default = False)
class LanguageName(IsName):
local_language_id = models.IntegerField()
#######################
# GENERATION MODELS #
#######################
class Generation(HasName):
main_region_id = models.IntegerField()
class GenerationName(IsName, HasGeneration):
pass
####################
# ABILITY MODELS #
####################
class Ability(HasName, HasGeneration):
is_main_series = models.BooleanField(default = False)
class AbilityDescription(IsEffectDescription, HasAbility):
pass
class AbilityFlavorText(IsFlavorText, HasAbility, HasVersionGroup):
pass
class AbilityName(IsName, HasAbility):
pass
#################
# TYPE MODELS #
#################
class Type(HasName, HasGeneration, HasMoveDamageClass):
pass
class TypeName(IsName, HasType):
pass
class TypeGameIndex(HasType, HasGeneration, HasGameIndex):
pass
class TypeEfficacy(models.Model):
damage_type_id = models.IntegerField()
target_type_id = models.IntegerField()
damage_factor = models.IntegerField()
#################
# STAT MODELS #
#################
class Stat(HasName, HasMoveDamageClass):
is_battle_only = models.BooleanField(default = False)
game_index = models.IntegerField()
class StatName(IsName, HasStat):
pass
###########################
# CHARACTERISTIC MODELS #
###########################
class Characteristic(HasStat):
gene_mod_5 = models.IntegerField()
class CharacteristicDescription(HasCharacteristic, IsDescription):
pass
######################
# EGG GROUP MODELS #
######################
class EggGroup(HasName):
pass
class EggGroupName(IsName, HasEggGroup):
pass
########################
# GROWTH RATE MODELS #
########################
class GrowthRate(HasName):
formula = models.CharField(max_length = 500)
class GrowthRateDescription(HasGrowthRate, IsDescription):
pass
###################
# NATURE MODELS #
###################
class Nature(HasName):
decreased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'decreased')
increased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'increased')
hates_flavor_id = models.IntegerField()
likes_flavor_id = models.IntegerField()
game_index = models.IntegerField()
class NatureName(IsName, HasNature):
pass
class NaturePokeathlonStat(HasNature):
pokeathlon_stat_id = models.ForeignKey(Stat, blank = True, null = True)
max_change = models.IntegerField()
class NatureBattleStylePreference(HasNature):
move_battle_style_id = models.IntegerField()
low_hp_preference = models.IntegerField()
high_hp_preference = models.IntegerField()
#################
# MOVE MODELS #
#################
class Move(HasName, HasGeneration, HasType, HasMoveDamageClass, HasMoveEffect, HasMoveTarget):
power = models.IntegerField(blank = True, null = True)
pp = models.IntegerField(blank = True, null = True)
accuracy = models.IntegerField(blank = True, null = True)
priority = models.IntegerField(blank = True, null = True)
move_effect_chance = models.IntegerField(blank = True, null = True)
contest_type_id = models.IntegerField(blank = True, null = True)
contest_effect_id = models.IntegerField(blank = True, null = True)
super_contest_effect_id = models.IntegerField(blank = True, null = True)
class MoveName(HasMove, IsName):
pass
class MoveFlavorText(HasMove, HasVersionGroup, IsFlavorText):
pass
class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect):
power = models.IntegerField(blank = True, null = True)
pp = models.IntegerField(blank = True, null = True)
accuracy = models.IntegerField(blank = True, null = True)
move_effect_chance = models.IntegerField(blank = True, null = True)
##############################
# MOVE DAMAGE CLASS MODELS #
##############################
class MoveDamageClass(HasName):
pass
class MoveDamageClassDescription(HasMoveDamageClass, IsDescription, HasName):
pass
##############################
# MOVE BATTLE STYLE MODELS #
##############################
class MoveBattleStyle(HasName):
pass
class MoveBattleStyleName(IsName):
move_battle_style = models.ForeignKey(MoveBattleStyle, blank = True, null = True)
########################
# MOVE EFFECT MODELS #
########################
class MoveEffect(models.Model):
pass
class MoveEffectDescription(HasMoveEffect, IsEffectDescription):
pass
class MoveEffectChange(HasMoveEffect, HasVersionGroup):
pass
class MoveEffectChangeDescription(HasLanguage):
move_effect_change = models.ForeignKey('MoveEffectChange', blank = True, null = True)
effect = models.CharField(max_length=2000)
######################
# MOVE FLAG MODELS #
######################
class MoveFlag(HasName):
pass
class MoveFlagDescription(HasMoveFlag, HasName, IsDescription):
pass
class MoveFlagMap(HasMove, HasMoveFlag):
pass
########################
# MOVE TARGET MODELS #
########################
class MoveTarget(HasName):
pass
class MoveTargetDescription(HasMoveTarget, IsDescription, HasName):
pass
######################
# MOVE META MODELS #
######################
class MoveMeta(HasMove, HasMetaAilment, HasMetaCategory):
min_hits = models.IntegerField(blank = True, null = True)
max_hits = models.IntegerField(blank = True, null = True)
min_turns = models.IntegerField(blank = True, null = True)
max_turns = models.IntegerField(blank = True, null = True)
drain = models.IntegerField(blank = True, null = True)
healing = models.IntegerField(blank = True, null = True)
crit_rate = models.IntegerField(blank = True, null = True)
ailment_chance = models.IntegerField(blank = True, null = True)
flinch_chance = models.IntegerField(blank = True, null = True)
stat_chance = models.IntegerField(blank = True, null = True)
class MoveMetaAilment(HasName):
pass
class MoveMetaAilmentName(HasMetaAilment, IsName):
pass
class MoveMetaCategory(HasName):
pass
class MoveMetaCategoryDescription(HasMetaCategory, IsDescription):
pass
class MoveMetaStatChange(HasMove, HasStat):
change = models.IntegerField()

View file

@ -38,7 +38,7 @@
</div><!-- /.header row -->
<div class="row pad_top">
<div class="col-md-3">
<div class="affix visible-md visible-lg" data-spy="affix" data-offset="200">
<div class="affix visible-md visible-lg" data-spy="affix" data-offset="200" style="position: fixed">
<ul class="nav">
<li><a href="#info">Information</a></li>
<li><a href="#wrap">Wrappers</a></li>
@ -80,6 +80,7 @@
<li><b>Racket</b> - <a href="https://github.com/scottlindeman/racketmon">Racketmon</a> by Scott Lindeman.</li>
<li><b>Java</b> - <a href="https://github.com/mickeyjk/PokeJava">PokeJava</a> by Mickeyjk.</li>
<li><b>Ruby</b> - <a href='https://github.com/baweaver/pokegem'>Pokegem</a> by Brandon Weaver.</li>
<li><b>Node</b> - <a href='https://github.com/TheIronDeveloper/pokeapi-node-wrapper'>PokeApi Node Wrapper</a> by Tyler Stark.</li>
</ul>
<p>Written a wrapper? Let us know and we'll add it to the list here.</p>
<div id="pokedex" style="padding-top:30px"></div>
@ -434,30 +435,27 @@
<p class="lead"> GET description/</p>
<p class="lead"> GET description/ID/ </p>
<h4>Example request</h4>
<pre>GET http://pokeapi.co/api/v1/description/1/</pre>
<pre>GET http://pokeapi.co/api/v1/description/2/</pre>
<p>Result:</p>
<pre class="pre-scrollable">
{
"created": "2013-11-02T12:19:03.576753",
"description": "A strange seed was planted on its back at birth. The plant sprouts and grows with this Pokémon.",
"games": [
{
"name": "Pokemon Blue",
"resource_uri": "/api/v1/game/2/"
created: '2013-12-24T17:14:38.281429',
description: 'A strange seed was planted on its back at birth. The plant sprouts and grows with this POKMON.',
games: [{
name: 'red(JPN)',
resource_uri: '/api/v1/game/1/'
}, {
name: 'green(JPN)',
resource_uri: '/api/v1/game/2/'
}],
id: 2,
modified: '2014-01-18T14:29:53.118541',
name: 'Bulbasaur_gen_1',
pokemon: {
name: 'bulbasaur',
resource_uri: '/api/v1/pokemon/1/'
},
{
"name": "Pokemon Red",
"resource_uri": "/api/v1/game/1/"
}
],
"id": 1,
"modified": "2013-11-02T12:19:24.334212",
"name": "Bulbasaur_red_blue",
"pokemon": {
"name": "bulbasaur",
"resource_uri": "/api/v1/pokemon/1/"
},
"resource_uri": "/api/v1/description/1/"
resource_uri: '/api/v1/description/2/'
}
</pre>
<p>Fields:</p>