From 3da53ae05114c4dcfa0451782c7fc588183a51df Mon Sep 17 00:00:00 2001 From: "Lynn \"Zhorken\" Vaughan" Date: Sat, 11 Dec 2010 12:10:08 -0500 Subject: [PATCH 1/1] =?utf8?q?Give=20abilities=20separate=20relations=20fo?= =?utf8?q?r=20all/normal/dream=20Pok=C3=A9mon.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- pokedex/db/tables.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 63b2efc..c4759e0 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -1306,8 +1306,25 @@ Ability.changelog = relation(AbilityChangelog, Ability.flavor_text = relation(AbilityFlavorText, order_by=AbilityFlavorText.version_group_id, backref='ability') Ability.foreign_names = relation(AbilityName, backref='ability') Ability.generation = relation(Generation, backref='abilities') +Ability.all_pokemon = relation(Pokemon, + secondary=PokemonAbility.__table__, + back_populates='all_abilities', +) Ability.pokemon = relation(Pokemon, secondary=PokemonAbility.__table__, + primaryjoin=and_( + PokemonAbility.ability_id == Ability.id, + PokemonAbility.is_dream == False + ), + back_populates='abilities', +) +Ability.dream_pokemon = relation(Pokemon, + secondary=PokemonAbility.__table__, + primaryjoin=and_( + PokemonAbility.ability_id == Ability.id, + PokemonAbility.is_dream == True + ), + back_populates='dream_ability', ) AbilityChangelog.changed_in = relation(VersionGroup, backref='ability_changelog') -- 2.7.4