mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Added PokemonMove.machine relation.
This commit is contained in:
parent
0a706d44a3
commit
2e49f953c3
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,7 @@ from sqlalchemy import Column, ForeignKey, MetaData, Table
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.ext.associationproxy import association_proxy
|
from sqlalchemy.ext.associationproxy import association_proxy
|
||||||
from sqlalchemy.orm import backref, relation
|
from sqlalchemy.orm import backref, relation
|
||||||
|
from sqlalchemy.sql import and_
|
||||||
from sqlalchemy.types import *
|
from sqlalchemy.types import *
|
||||||
from sqlalchemy.databases.mysql import *
|
from sqlalchemy.databases.mysql import *
|
||||||
|
|
||||||
|
@ -534,6 +535,11 @@ PokemonFormSprite.introduced_in = relation(VersionGroup)
|
||||||
|
|
||||||
PokemonMove.pokemon = relation(Pokemon, backref='pokemon_moves')
|
PokemonMove.pokemon = relation(Pokemon, backref='pokemon_moves')
|
||||||
PokemonMove.version_group = relation(VersionGroup)
|
PokemonMove.version_group = relation(VersionGroup)
|
||||||
|
PokemonMove.machine = relation(Machine, backref='pokemon_moves',
|
||||||
|
primaryjoin=and_(Machine.version_group_id==PokemonMove.version_group_id,
|
||||||
|
Machine.move_id==PokemonMove.move_id),
|
||||||
|
foreign_keys=[Machine.version_group_id, Machine.move_id],
|
||||||
|
uselist=False)
|
||||||
PokemonMove.move = relation(Move, backref='pokemon_moves')
|
PokemonMove.move = relation(Move, backref='pokemon_moves')
|
||||||
PokemonMove.method = relation(PokemonMoveMethod)
|
PokemonMove.method = relation(PokemonMoveMethod)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue