-Pokemon.abilities = relation(Ability, secondary=PokemonAbility.__table__,
- order_by=PokemonAbility.slot,
- backref='pokemon')
+Pokemon.all_abilities = relation(Ability,
+ secondary=PokemonAbility.__table__,
+ order_by=PokemonAbility.slot,
+)
+Pokemon.abilities = relation(Ability,
+ secondary=PokemonAbility.__table__,
+ primaryjoin=and_(
+ Pokemon.id == PokemonAbility.pokemon_id,
+ PokemonAbility.is_dream == False,
+ ),
+ order_by=PokemonAbility.slot,
+)
+Pokemon.dream_ability = relation(Ability,
+ secondary=PokemonAbility.__table__,
+ primaryjoin=and_(
+ Pokemon.id == PokemonAbility.pokemon_id,
+ PokemonAbility.is_dream == True,
+ ),
+ uselist=False,
+)