Completed Models/Build Script

-Added models for Pokemon, Moves, and all other remaining models.

-Added new models to build script

-Build script will now clean and reset auto-incrementers for each table
in pokeapi_co_db

-Build script now runs against both postgres and sqlite (dev)

-Added all models to admin site registry

-Added instructions for building out db in README
This commit is contained in:
Zane Adickes 2015-04-20 23:31:59 -04:00
parent 5ad1cb0ea5
commit 49926dc026
6 changed files with 5090 additions and 1390 deletions

View file

@ -42,6 +42,19 @@ If you ever need to wipe the database use this command:
$ make wipe_db $ make wipe_db
``` ```
## V2 Database setup
To build out the data you'll need to jump into the Django shell
```
$ python manage.py shell
```
and run the build script with
```
$ execfile('data/v2/build.py')
```
Each time the build script is run it will iterate over each table in the database, wipe it and rewrite each row using the data found in data/v2/csv.
If you don't need all of the data just go into data/v2/build.py and comment out everything but what you need to build the tables you're looking for. This might be useful because some of the csv files are massive (pokemon_moves expecially) and it can take about 30 minutes to build everything.
## Contributing ## Contributing

File diff suppressed because it is too large Load diff

159
pokemon_v2/admin.py Normal file → Executable file
View file

@ -3,19 +3,164 @@ from django.contrib import admin
from .models import * from .models import *
admin.site.register(Language) admin.site.register(Ability)
admin.site.register(LanguageName) admin.site.register(AbilityName)
admin.site.register(AbilityDescription)
admin.site.register(AbilityFlavorText)
admin.site.register(AbilityChange)
admin.site.register(AbilityChangeDescription)
admin.site.register(Berry)
admin.site.register(BerryFirmness)
admin.site.register(BerryFirmnessName)
admin.site.register(BerryFlavor)
admin.site.register(Characteristic)
admin.site.register(CharacteristicDescription)
admin.site.register(ContestCombo)
admin.site.register(ContestEffectDescription)
admin.site.register(ContestEffect)
admin.site.register(ContestType)
admin.site.register(ContestTypeName)
admin.site.register(EggGroup)
admin.site.register(EggGroupName)
admin.site.register(EncounterCondition)
admin.site.register(EncounterConditionValue)
admin.site.register(EncounterConditionName)
admin.site.register(EncounterConditionValueName)
admin.site.register(EncounterConditionValueMap)
admin.site.register(EncounterMethod)
admin.site.register(EncounterMethodName)
admin.site.register(EncounterSlot)
admin.site.register(Encounter)
admin.site.register(EvolutionChain)
admin.site.register(EvolutionTrigger)
admin.site.register(EvolutionTriggerName)
admin.site.register(Experience)
admin.site.register(Gender)
admin.site.register(Generation) admin.site.register(Generation)
admin.site.register(GenerationName) admin.site.register(GenerationName)
admin.site.register(GrowthRate)
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(ItemFlavorText)
admin.site.register(ItemFlingEffect)
admin.site.register(ItemFlingEffectDescription)
admin.site.register(ItemGameIndex)
admin.site.register(ItemName)
admin.site.register(ItemPocketName)
admin.site.register(ItemPocket)
admin.site.register(ItemDescription)
admin.site.register(Item)
admin.site.register(Language)
admin.site.register(LanguageName)
admin.site.register(LocationAreaEncounterRate)
admin.site.register(LocationAreaName)
admin.site.register(LocationArea)
admin.site.register(LocationGameIndex)
admin.site.register(LocationName)
admin.site.register(Location)
admin.site.register(Machine)
admin.site.register(MoveBattleStyle)
admin.site.register(MoveBattleStyleName)
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(MoveEffect)
admin.site.register(MoveFlagMap)
admin.site.register(MoveFlagDescription)
admin.site.register(MoveFlag)
admin.site.register(MoveFlavorText)
admin.site.register(MoveMeta)
admin.site.register(MoveMetaAilment)
admin.site.register(MoveMetaAilmentName)
admin.site.register(MoveMetaCategoryDescription)
admin.site.register(MoveMetaCategory)
admin.site.register(MoveMetaStatChange)
admin.site.register(MoveName)
admin.site.register(MoveTargetDescription)
admin.site.register(MoveTarget)
admin.site.register(Move)
admin.site.register(NatureBattleStylePreference)
admin.site.register(NatureName)
admin.site.register(NaturePokeathlonStat)
admin.site.register(Nature)
admin.site.register(PalParkArea)
admin.site.register(PalParkAreaName)
admin.site.register(PalPark)
admin.site.register(PokeathlonStatName)
admin.site.register(PokeathlonStat)
admin.site.register(Pokedex)
admin.site.register(PokedexVersionGroup)
admin.site.register(PokedexDescription)
admin.site.register(Pokemon)
admin.site.register(PokemonAbility)
admin.site.register(PokemonColor)
admin.site.register(PokemonColorName)
admin.site.register(PokemonDexNumber)
admin.site.register(PokemonEggGroup)
admin.site.register(PokemonEvolution)
admin.site.register(PokemonForm)
admin.site.register(PokemonFormName)
admin.site.register(PokemonFormGeneration)
admin.site.register(PokemonGameIndex)
admin.site.register(PokemonHabitat)
admin.site.register(PokemonHabitatName)
admin.site.register(PokemonItem)
admin.site.register(PokemonMove)
admin.site.register(PokemonMoveMethod)
admin.site.register(PokemonMoveMethodName)
admin.site.register(PokemonShape)
admin.site.register(PokemonShapeName)
admin.site.register(PokemonSpecies)
admin.site.register(PokemonSpeciesName)
admin.site.register(PokemonSpeciesDescription)
admin.site.register(PokemonSpeciesFlavorText)
admin.site.register(PokemonStat)
admin.site.register(PokemonType)
admin.site.register(Region)
admin.site.register(RegionName)
admin.site.register(StatName)
admin.site.register(Stat)
admin.site.register(SuperContestEffect)
admin.site.register(SuperContestCombo)
admin.site.register(SuperContestEffectDescription)
admin.site.register(Type)
admin.site.register(TypeName)
admin.site.register(TypeGameIndex)
admin.site.register(TypeEfficacy)
admin.site.register(Version) admin.site.register(Version)
admin.site.register(VersionName) admin.site.register(VersionName)
admin.site.register(VersionGroup) admin.site.register(VersionGroup)
admin.site.register(VersionGroupRegion) admin.site.register(VersionGroupRegion)
admin.site.register(VersionGroupPokemonMoveMethod) 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

File diff suppressed because it is too large Load diff

808
pokemon_v2/models.py Normal file → Executable file
View file

@ -22,9 +22,33 @@ class HasCharacteristic(models.Model):
abstract = True abstract = True
class HasContestType(models.Model):
contest_type = models.ForeignKey('ContestType', blank=True, null=True)
class Meta:
abstract = True
class HasDescription(models.Model): class HasDescription(models.Model):
description = models.CharField(max_length=200, default='') description = models.CharField(max_length=1000, default='')
class Meta:
abstract = True
class HasGender(models.Model):
gender = models.ForeignKey('Gender', blank=True, null=True)
class Meta:
abstract = True
class HasEffect(models.Model):
effect = models.CharField(max_length=4000)
class Meta: class Meta:
abstract = True abstract = True
@ -38,9 +62,41 @@ class HasEggGroup(models.Model):
abstract = True abstract = True
class HasEncounterMethod(models.Model):
encounter_method = models.ForeignKey('EncounterMethod', blank=True, null=True)
class Meta:
abstract = True
class HasEncounterCondition(models.Model):
encounter_condition = models.ForeignKey('EncounterCondition', blank=True, null=True)
class Meta:
abstract = True
class HasEvolutionTrigger(models.Model):
evolution_trigger = models.ForeignKey('EvolutionTrigger', blank=True, null=True)
class Meta:
abstract = True
class HasFlavorText(models.Model): class HasFlavorText(models.Model):
flavor_text = models.CharField(max_length=200) flavor_text = models.CharField(max_length=500)
class Meta:
abstract = True
class HasFlingEffect(models.Model):
item_fling_effect = models.ForeignKey('ItemFlingEffect', blank=True, null=True)
class Meta: class Meta:
abstract = True abstract = True
@ -70,6 +126,30 @@ class HasGrowthRate(models.Model):
abstract = True abstract = True
class HasItem(models.Model):
item = models.ForeignKey('Item', blank=True, null=True)
class Meta:
abstract = True
class HasItemCategory(models.Model):
item_category = models.ForeignKey('ItemCategory', blank=True, null=True)
class Meta:
abstract = True
class HasItemPocket(models.Model):
item_pocket = models.ForeignKey('ItemPocket', blank=True, null=True)
class Meta:
abstract = True
class HasLanguage(models.Model): class HasLanguage(models.Model):
language = models.ForeignKey('Language', blank = True, null = True) language = models.ForeignKey('Language', blank = True, null = True)
@ -78,6 +158,22 @@ class HasLanguage(models.Model):
abstract = True abstract = True
class HasLocation(models.Model):
location = models.ForeignKey('Location', blank = True, null = True)
class Meta:
abstract = True
class HasLocationArea(models.Model):
location_area = models.ForeignKey('LocationArea', blank = True, null = True)
class Meta:
abstract = True
class HasMetaAilment(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)
@ -152,7 +248,95 @@ class HasNature(models.Model):
class HasOrder(models.Model): class HasOrder(models.Model):
order = models.IntegerField() order = models.IntegerField(blank=True, null=True)
class Meta:
abstract = True
class HasPokeathlonStat(models.Model):
pokeathlon_stat = models.ForeignKey('PokeathlonStat', blank=True, null=True)
class Meta:
abstract = True
class HasPokedex(models.Model):
pokedex = models.ForeignKey('Pokedex', blank=True, null=True)
class Meta:
abstract = True
class HasPokemon(models.Model):
pokemon = models.ForeignKey('Pokemon', blank=True, null=True)
class Meta:
abstract = True
class HasPokemonColor(models.Model):
pokemon_color = models.ForeignKey('PokemonColor', blank=True, null=True)
class Meta:
abstract = True
class HasPokemonForm(models.Model):
pokemon_form = models.ForeignKey('PokemonForm', blank=True, null=True)
class Meta:
abstract = True
class HasPokemonHabitat(models.Model):
pokemon_habitat = models.ForeignKey('PokemonHabitat', blank=True, null=True)
class Meta:
abstract = True
class HasPokemonMoveMethod(models.Model):
pokemon_move_method = models.ForeignKey('PokemonMoveMethod', blank=True, null=True)
class Meta:
abstract = True
class HasPokemonShape(models.Model):
pokemon_shape = models.ForeignKey('PokemonShape', blank=True, null=True)
class Meta:
abstract = True
class HasPokemonSpecies(models.Model):
pokemon_species = models.ForeignKey('PokemonSpecies', blank=True, null=True)
class Meta:
abstract = True
class HasRegion(models.Model):
region = models.ForeignKey('Region', blank=True, null=True)
class Meta:
abstract = True
class HasShortEffect(models.Model):
short_effect = models.CharField(max_length=300)
class Meta: class Meta:
abstract = True abstract = True
@ -174,6 +358,14 @@ class HasType(models.Model):
abstract = True abstract = True
class HasVersion(models.Model):
version = models.ForeignKey('Version', blank=True, null=True)
class Meta:
abstract = True
class HasVersionGroup(models.Model): class HasVersionGroup(models.Model):
version_group = models.ForeignKey('VersionGroup', blank=True, null=True) version_group = models.ForeignKey('VersionGroup', blank=True, null=True)
@ -182,28 +374,12 @@ class HasVersionGroup(models.Model):
abstract = True abstract = True
class IsName(HasLanguage, HasName):
class Meta:
abstract = True
class IsDescription(HasLanguage, HasDescription): class IsDescription(HasLanguage, HasDescription):
class Meta: class Meta:
abstract = True 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 IsName(HasLanguage, HasName):
class Meta: class Meta:
@ -223,6 +399,7 @@ class IsFlavorText(HasLanguage, HasFlavorText):
class Version(HasName, HasVersionGroup): class Version(HasName, HasVersionGroup):
pass pass
class VersionName(IsName): class VersionName(IsName):
version = models.ForeignKey('Version', blank=True, null=True) version = models.ForeignKey('Version', blank=True, null=True)
@ -232,9 +409,8 @@ class VersionGroup(HasName, HasGeneration, HasOrder):
pass pass
class VersionGroupRegion(HasVersionGroup): class VersionGroupRegion(HasVersionGroup, HasRegion):
pass
region_id = models.IntegerField()
class VersionGroupPokemonMoveMethod(HasVersionGroup): class VersionGroupPokemonMoveMethod(HasVersionGroup):
@ -266,9 +442,8 @@ class LanguageName(IsName):
# GENERATION MODELS # # GENERATION MODELS #
####################### #######################
class Generation(HasName): class Generation(HasName, HasRegion):
pass
main_region_id = models.IntegerField()
class GenerationName(IsName, HasGeneration): class GenerationName(IsName, HasGeneration):
@ -276,6 +451,19 @@ class GenerationName(IsName, HasGeneration):
###################
# REGION MODELS #
###################
class Region(HasName):
pass
class RegionName(IsName, HasRegion):
pass
#################### ####################
# ABILITY MODELS # # ABILITY MODELS #
#################### ####################
@ -285,7 +473,7 @@ class Ability(HasName, HasGeneration):
is_main_series = models.BooleanField(default = False) is_main_series = models.BooleanField(default = False)
class AbilityDescription(IsEffectDescription, HasAbility): class AbilityDescription(HasLanguage, HasEffect, HasShortEffect, HasAbility):
pass pass
@ -297,6 +485,15 @@ class AbilityName(IsName, HasAbility):
pass pass
class AbilityChange(HasAbility):
pass
class AbilityChangeDescription(HasLanguage, HasEffect):
ability_change = models.ForeignKey(AbilityChange, blank=True, null=True)
################# #################
# TYPE MODELS # # TYPE MODELS #
@ -367,6 +564,146 @@ class EggGroupName(IsName, HasEggGroup):
#################
# ITEM MODELS #
#################
class ItemPocket(HasName):
pass
class ItemPocketName(IsName, HasItemPocket):
pass
class ItemCategory(HasName, HasItemPocket):
pass
class ItemCategoryName(IsName, HasItemCategory):
pass
class ItemFlingEffect(models.Model):
pass
class ItemFlingEffectDescription(HasFlingEffect, HasLanguage, HasEffect):
pass
class Item(HasName, HasItemCategory, HasFlingEffect):
cost = models.IntegerField(blank=True, null=True)
fling_power = models.IntegerField(blank=True, null=True)
class ItemDescription(HasLanguage, HasEffect, HasShortEffect):
item = models.ForeignKey(Item, blank=True, null=True)
class ItemName(HasItem, IsName):
pass
class ItemFlavorText(HasItem, HasVersionGroup, IsFlavorText):
pass
class ItemFlag(HasName):
pass
class ItemFlagDescription(IsDescription, HasName):
item_flag = models.ForeignKey(ItemFlag, blank=True, null=True)
class ItemFlagMap(HasItem):
item_flag = models.ForeignKey(ItemFlag, blank=True, null=True)
class ItemGameIndex(HasItem, HasGeneration, HasGameIndex):
pass
####################
# CONTEST MODELS #
####################
class ContestType(HasName):
pass
class ContestTypeName(HasContestType, IsName):
flavor = models.CharField(max_length = 10)
color = models.CharField(max_length = 10)
class ContestEffect(models.Model):
appeal = models.IntegerField()
jam = models.IntegerField()
class ContestEffectDescription(HasLanguage, HasEffect, HasFlavorText):
contest_effect = models.ForeignKey(ContestEffect, blank=True, null=True)
class ContestCombo(models.Model):
first_move = models.ForeignKey('Move', blank=True, null=True, related_name='first_move')
second_move = models.ForeignKey('Move', blank=True, null=True, related_name='second_move')
##################
# BERRY MODELS #
##################
class BerryFirmness(HasName):
pass
class BerryFirmnessName(IsName):
berry_firmness = models.ForeignKey(BerryFirmness, blank=True, null=True)
class Berry(HasItem, HasNature):
berry_firmness = models.ForeignKey(BerryFirmness, blank=True, null=True)
natural_gift_power = models.IntegerField()
size = models.IntegerField()
max_harvest = models.IntegerField()
growth_time = models.IntegerField()
soil_dryness = models.IntegerField()
smoothness = models.IntegerField()
class BerryFlavor(HasContestType):
berry = models.ForeignKey(Berry, blank=True, null=True)
flavor = models.IntegerField()
######################## ########################
# GROWTH RATE MODELS # # GROWTH RATE MODELS #
######################## ########################
@ -391,9 +728,9 @@ class Nature(HasName):
increased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'increased') increased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'increased')
hates_flavor_id = models.IntegerField() hates_flavor_id = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'hates_flavor')
likes_flavor_id = models.IntegerField() likes_flavor_id = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'likes_flavor')
game_index = models.IntegerField() game_index = models.IntegerField()
@ -402,9 +739,7 @@ class NatureName(IsName, HasNature):
pass pass
class NaturePokeathlonStat(HasNature): class NaturePokeathlonStat(HasNature, HasPokeathlonStat):
pokeathlon_stat_id = models.ForeignKey(Stat, blank = True, null = True)
max_change = models.IntegerField() max_change = models.IntegerField()
@ -419,6 +754,90 @@ class NatureBattleStylePreference(HasNature):
#####################
# LOCATION MODELS #
#####################
class Location(HasRegion, HasName):
pass
class LocationName(HasLocation, IsName):
pass
class LocationGameIndex(HasLocation, HasGeneration, HasGameIndex):
pass
class LocationArea(HasLocation, HasGameIndex, HasName):
pass
class LocationAreaName(IsName, HasLocationArea):
pass
class LocationAreaEncounterRate(HasEncounterMethod, HasLocationArea, HasVersion):
rate = models.IntegerField()
######################
# ENCOUNTER MODELS #
######################
class EncounterMethod(HasName, HasOrder):
pass
class EncounterMethodName(HasEncounterMethod, IsName):
pass
class EncounterSlot(HasVersionGroup, HasEncounterMethod):
slot = models.IntegerField(blank = True, null = True)
rarity = models.IntegerField()
class Encounter(HasVersion, HasLocationArea, HasPokemon):
encounter_slot = models.ForeignKey(EncounterSlot, blank = True, null = True)
min_level = models.IntegerField()
max_level = models.IntegerField()
class EncounterCondition(HasName):
pass
class EncounterConditionName(HasEncounterCondition, IsName):
pass
class EncounterConditionValue(HasEncounterCondition, HasName):
is_default = models.BooleanField(default = False)
class EncounterConditionValueName(IsName):
encounter_condition_value = models.ForeignKey(EncounterConditionValue, blank = True, null = True)
class EncounterConditionValueMap(models.Model):
encounter = models.ForeignKey(Encounter, blank = True, null = True)
encounter_condition_value = models.ForeignKey(EncounterConditionValue, blank = True, null = True)
################# #################
# MOVE MODELS # # MOVE MODELS #
################# #################
@ -497,7 +916,7 @@ class MoveEffect(models.Model):
pass pass
class MoveEffectDescription(HasMoveEffect, IsEffectDescription): class MoveEffectDescription(HasLanguage, HasMoveEffect, HasEffect, HasShortEffect):
pass pass
@ -505,12 +924,10 @@ class MoveEffectChange(HasMoveEffect, HasVersionGroup):
pass pass
class MoveEffectChangeDescription(HasLanguage): class MoveEffectChangeDescription(HasLanguage, HasEffect):
move_effect_change = models.ForeignKey('MoveEffectChange', blank = True, null = True) move_effect_change = models.ForeignKey('MoveEffectChange', blank = True, null = True)
effect = models.CharField(max_length=2000)
###################### ######################
@ -589,3 +1006,324 @@ class MoveMetaCategoryDescription(HasMetaCategory, IsDescription):
class MoveMetaStatChange(HasMove, HasStat): class MoveMetaStatChange(HasMove, HasStat):
change = models.IntegerField() change = models.IntegerField()
#######################
# EXPERIENCE MODELS #
#######################
class Experience(HasGrowthRate):
level = models.IntegerField()
experience = models.IntegerField()
###################
# GENDER MODELS #
###################
class Gender(HasName):
pass
####################
# MACHINE MODELS #
####################
class Machine(HasGrowthRate, HasItem):
machine_number = models.IntegerField()
version_group = models.ForeignKey(VersionGroup, blank=True, null=True)
move = models.ForeignKey(Move, blank=True, null=True)
#######################
# POKEATHLON MODELS #
#######################
class PokeathlonStat(HasName):
pass
class PokeathlonStatName(IsName, HasPokeathlonStat):
pass
#####################
# PAL PARK MODELS #
#####################
class PalParkArea(HasName):
pass
class PalParkAreaName(IsName):
pal_park_area = models.ForeignKey(PalParkArea, blank = True, null = True)
class PalPark(HasPokemonSpecies):
pal_park_area = models.ForeignKey(PalParkArea, blank = True, null = True)
base_score = models.IntegerField(blank = True, null = True)
rate = models.IntegerField()
##########################
# SUPER CONTEST MODELS #
##########################
class SuperContestEffect(models.Model):
appeal = models.IntegerField()
class SuperContestEffectDescription(IsFlavorText):
super_contest_effect = models.ForeignKey(SuperContestEffect, blank = True, null = True)
class SuperContestCombo(models.Model):
first_move = models.ForeignKey(Move, blank = True, null = True, related_name = 'first')
second_move = models.ForeignKey(Move, blank = True, null = True, related_name = 'second')
######################
# EVOLUTION MODELS #
######################
class EvolutionChain(models.Model):
baby_evolution_item = models.ForeignKey(Item, blank=True, null=True)
class EvolutionTrigger(HasName):
pass
class EvolutionTriggerName(HasEvolutionTrigger, IsName):
pass
####################
# POKEDEX MODELS #
####################
class Pokedex(HasName, HasRegion):
is_main_series = models.BooleanField(default = False)
class PokedexDescription(HasPokedex, HasName, IsDescription):
pass
class PokedexVersionGroup(HasPokedex, HasVersionGroup):
pass
####################
# POKEMON MODELS #
####################
class PokemonSpecies(HasName, HasGeneration, HasPokemonColor,
HasPokemonShape, HasGrowthRate, HasOrder):
evolves_from_species = models.ForeignKey('self', blank=True, null=True)
evolution_chain = models.ForeignKey(EvolutionChain, blank=True, null=True)
pokemon_habitat = models.ForeignKey('PokemonHabitat', blank=True, null=True)
gender_rate = models.IntegerField()
capture_rate = models.IntegerField()
base_happiness = models.IntegerField()
is_baby = models.BooleanField(default = False)
hatch_counter = models.IntegerField()
has_gender_differences = models.BooleanField(default = False)
forms_switchable = models.BooleanField(default = False)
class PokemonSpeciesName(IsName, HasPokemonSpecies):
genus = models.CharField(max_length = 30)
class PokemonSpeciesDescription(HasPokemonSpecies, IsDescription):
pass
class PokemonSpeciesFlavorText(IsFlavorText, HasPokemonSpecies, HasVersion):
pass
class Pokemon(HasName, HasPokemonSpecies, HasOrder):
height = models.IntegerField()
weight = models.IntegerField()
base_experience = models.IntegerField()
is_default = models.BooleanField(default = False)
class PokemonAbility(HasPokemon, HasAbility):
is_hidden = models.BooleanField(default = False)
slot = models.IntegerField()
class PokemonColor(HasName):
pass
class PokemonColorName(HasPokemonColor, IsName):
pass
class PokemonDexNumber(HasPokemonSpecies, HasPokedex):
pokedex_number = models.IntegerField()
class PokemonEggGroup(HasPokemonSpecies, HasEggGroup):
pass
class PokemonEvolution(HasEvolutionTrigger, HasGender):
evolution_item = models.ForeignKey(Item, blank=True, null=True, related_name='evolution_item')
evolved_species = models.ForeignKey(PokemonSpecies, related_name="evolved_species", blank=True, null=True)
min_level = models.IntegerField(blank=True, null=True)
location_id = models.IntegerField(blank=True, null=True) # need location tables
held_item = models.ForeignKey(Item, blank=True, null=True, related_name='held_item')
time_of_day = models.CharField(max_length = 10, blank=True, null=True)
known_move = models.ForeignKey(Move, blank=True, null=True)
known_move_type = models.ForeignKey(Type, related_name="known_move", blank=True, null=True)
min_happiness = models.IntegerField(blank=True, null=True)
min_beauty = models.IntegerField(blank=True, null=True)
min_affection = models.IntegerField(blank=True, null=True)
relative_physical_stats = models.IntegerField(blank=True, null=True)
party_species = models.ForeignKey(PokemonSpecies, related_name="party_species", blank=True, null=True)
party_type = models.ForeignKey(Type, related_name="party_type", blank=True, null=True)
trade_species = models.ForeignKey(PokemonSpecies, related_name="trade_species", blank=True, null=True)
needs_overworld_rain = models.BooleanField(default = False)
turn_upside_down = models.BooleanField(default = False)
class PokemonForm(HasName, HasPokemon, HasOrder):
form_identifier = models.CharField(max_length = 30)
introduced_in_version_group = models.ForeignKey(VersionGroup, blank=True, null=True)
is_default = models.BooleanField(default = False)
is_battle_only = models.BooleanField(default = False)
is_mega = models.BooleanField(default = False)
form_order = models.IntegerField(blank=True, null=True)
class PokemonFormGeneration(HasPokemonForm, HasGeneration, HasGameIndex):
pass
class PokemonFormName(HasPokemonForm, IsName):
pokemon_name = models.CharField(max_length = 30)
class PokemonGameIndex(HasPokemon, HasGameIndex, HasVersion):
pass
class PokemonHabitat(HasName):
pass
class PokemonHabitatName(IsName):
pokemon_habitat = models.ForeignKey(PokemonHabitat, blank=True, null=True)
class PokemonItem(HasPokemon, HasVersion, HasItem):
rarity = models.IntegerField()
class PokemonMoveMethod(HasName):
pass
class PokemonMoveMethodName(IsName, HasPokemonMoveMethod, HasDescription):
pass
class PokemonMove(HasPokemon, HasPokemonMoveMethod, HasVersionGroup, HasMove, HasOrder):
level = models.IntegerField()
class PokemonShape(HasName):
pass
class PokemonShapeName(IsName):
awesome_name = models.CharField(max_length = 30)
pokemon_shape = models.ForeignKey(PokemonShape, blank=True, null=True)
class PokemonStat(HasPokemon, HasStat):
base_stat = models.IntegerField()
effort = models.IntegerField()
class PokemonType(HasPokemon, HasType):
slot = models.IntegerField()