From 3c76c080427baa2b2745e83dcc63bcb5c7fe0e66 Mon Sep 17 00:00:00 2001 From: "Lynn \"Zhorken\" Vaughan" Date: Tue, 31 Jul 2012 23:43:24 -0400 Subject: [PATCH] Add and tweak more relationships. --- .../data/csv/conquest_warrior_rank_stat_map.csv | 2 +- pokedex/db/tables.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pokedex/data/csv/conquest_warrior_rank_stat_map.csv b/pokedex/data/csv/conquest_warrior_rank_stat_map.csv index 665a637..3a25e7e 100644 --- a/pokedex/data/csv/conquest_warrior_rank_stat_map.csv +++ b/pokedex/data/csv/conquest_warrior_rank_stat_map.csv @@ -1,4 +1,4 @@ -warrior_rank_id,warrior_stat_id,stat +warrior_rank_id,warrior_stat_id,base_stat 1,1,65 1,2,60 1,3,65 diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 7499769..afbb0b5 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -398,7 +398,7 @@ class ConquestWarriorRankStatMap(TableBase): info=dict(description=u'The ID of the warrior rank.')) warrior_stat_id = Column(Integer, ForeignKey('conquest_warrior_stats.id'), primary_key=True, autoincrement=False, info=dict(description=u'The ID of the warrior stat.')) - stat = Column(Integer, nullable=False, + base_stat = Column(Integer, nullable=False, info=dict(description=u'The stat.')) class ConquestWarriorSkill(TableBase): @@ -1958,7 +1958,7 @@ ConquestMaxLink.pokemon = relationship(PokemonSpecies, ConquestMaxLink.warrior_rank = relationship(ConquestWarriorRank, uselist=False, innerjoin=True, lazy='joined', - backref='max_links') + backref=backref('max_links', lazy='dynamic')) ConquestMaxLink.warrior = association_proxy('warrior_rank', 'warrior') ConquestPokemonEvolution.gender = relationship(Gender, @@ -1977,6 +1977,9 @@ ConquestPokemonStat.stat = relationship(ConquestStat, uselist=False, backref='pokemon_stats') +ConquestWarrior.archetype = relationship(ConquestWarriorArchetype, + uselist=False, + backref=backref('warriors')) ConquestWarrior.ranks = relationship(ConquestWarriorRank, order_by=ConquestWarriorRank.rank, innerjoin=True, lazy='joined', @@ -1990,12 +1993,17 @@ ConquestWarrior.types = relationship(Type, ConquestWarriorRank.skill = relationship(ConquestWarriorSkill, uselist=False, innerjoin=True, lazy='joined', - backref='warrior_ranks') + backref=backref('warrior_ranks', order_by=ConquestWarriorRank.id)) ConquestWarriorRank.stats = relationship(ConquestWarriorRankStatMap, innerjoin=True, lazy='joined', order_by = ConquestWarriorRankStatMap.warrior_stat_id, backref=backref('warrior_rank', uselist=False, innerjoin=True)) +ConquestWarriorRankStatMap.stat = relationship(ConquestWarriorStat, + innerjoin=True, lazy='joined', + uselist=False, + backref='stat_map') + ContestCombo.first = relationship(Move, primaryjoin=ContestCombo.first_move_id==Move.id,