mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Give abilities separate relations for all/normal/dream Pokémon.
This commit is contained in:
parent
efe0948c72
commit
535b6cfa73
1 changed files with 17 additions and 0 deletions
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue