Début import législatives 2022
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
from .base import Base
|
||||
from .geographie import *
|
||||
from .legislatives2022 import *
|
||||
from .europeennes2024 import *
|
||||
|
@ -15,6 +15,7 @@ class Region(Base):
|
||||
|
||||
departements: Mapped[List["Departement"]] = relationship("Departement", back_populates="region")
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsRegionLegislatives2022", back_populates="region")
|
||||
resultats_europeennes_2024 = relationship("ResultatsRegionEuropeennes2024", back_populates="region")
|
||||
|
||||
|
||||
@ -30,6 +31,7 @@ class Departement(Base):
|
||||
circonscriptions: Mapped[List["Circonscription"]] = relationship("Circonscription", back_populates="departement")
|
||||
communes: Mapped[List["Commune"]] = relationship("Commune", back_populates="departement")
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsDepartementLegislatives2022", back_populates="departement")
|
||||
resultats_europeennes_2024 = relationship("ResultatsDepartementEuropeennes2024", back_populates="departement")
|
||||
|
||||
|
||||
@ -44,6 +46,7 @@ class Commune(Base):
|
||||
departement: Mapped[Departement] = relationship(Departement, back_populates="communes")
|
||||
bureaux_vote: Mapped[List["BureauVote"]] = relationship("BureauVote", back_populates="commune")
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsCommuneLegislatives2022", back_populates="commune")
|
||||
resultats_europeennes_2024 = relationship("ResultatsCommuneEuropeennes2024", back_populates="commune")
|
||||
|
||||
|
||||
@ -58,6 +61,9 @@ class Circonscription(Base):
|
||||
departement: Mapped[Departement] = relationship(Departement, back_populates="circonscriptions")
|
||||
bureaux_vote: Mapped[List["BureauVote"]] = relationship("BureauVote", back_populates="circonscription")
|
||||
|
||||
candidats_legislatives_2022 = relationship("CandidatLegislatives2022", back_populates="circonscription")
|
||||
resultats_legislatives_2022 = relationship("ResultatsCirconscriptionLegislatives2022",
|
||||
back_populates="circonscription")
|
||||
resultats_europeennes_2024 = relationship("ResultatsCirconscriptionEuropeennes2024",
|
||||
back_populates="circonscription")
|
||||
|
||||
@ -76,4 +82,5 @@ class BureauVote(Base):
|
||||
commune: Mapped[Commune] = relationship(Commune, back_populates="bureaux_vote")
|
||||
circonscription: Mapped[Circonscription] = relationship(Circonscription, back_populates="bureaux_vote")
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsBureauVoteLegislatives2022", back_populates="bureau_vote")
|
||||
resultats_europeennes_2024 = relationship("ResultatsBureauVoteEuropeennes2024", back_populates="bureau_vote")
|
||||
|
338
nupes/models/legislatives2022.py
Normal file
338
nupes/models/legislatives2022.py
Normal file
@ -0,0 +1,338 @@
|
||||
import enum
|
||||
from datetime import date
|
||||
from typing import List
|
||||
|
||||
from sqlalchemy import Boolean, Date, Enum, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import mapped_column, Mapped, relationship
|
||||
|
||||
from nupes.models import Base, Region, Departement, Commune, Circonscription
|
||||
|
||||
|
||||
class BlocLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_bloc"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nom: Mapped[str] = mapped_column(String(32), unique=True)
|
||||
couleur: Mapped[str] = mapped_column(String(7))
|
||||
|
||||
candidats: Mapped[List["CandidatLegislatives2022"]] = relationship("CandidatLegislatives2022",
|
||||
back_populates="bloc")
|
||||
|
||||
nuances: Mapped[List["NuanceLegislatives2022"]] = relationship(
|
||||
"NuanceLegislatives2022", back_populates="bloc")
|
||||
|
||||
|
||||
class NuanceLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_nuance"
|
||||
|
||||
code: Mapped[str] = mapped_column(String(8), primary_key=True)
|
||||
nom: Mapped[str] = mapped_column(String(64), unique=True)
|
||||
couleur: Mapped[str] = mapped_column(String(7))
|
||||
bloc_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_bloc.id"))
|
||||
|
||||
bloc: Mapped[BlocLegislatives2022] = relationship(BlocLegislatives2022, back_populates="nuances")
|
||||
|
||||
candidats: Mapped[List["CandidatLegislatives2022"]] = relationship(
|
||||
"CandidatLegislatives2022", back_populates="nuance")
|
||||
|
||||
resultats_nationaux: Mapped[List["VoixFranceLegislatives2022"]] = relationship(
|
||||
"VoixFranceLegislatives2022", back_populates="nuance")
|
||||
resultats_par_region: Mapped[List["VoixRegionLegislatives2022"]] = relationship(
|
||||
"VoixRegionLegislatives2022", back_populates="nuance")
|
||||
resultats_par_departement: Mapped[List["VoixDepartementLegislatives2022"]] = relationship(
|
||||
"VoixDepartementLegislatives2022", back_populates="nuance")
|
||||
resultats_par_commune: Mapped[List["VoixCommuneLegislatives2022"]] = relationship(
|
||||
"VoixCommuneLegislatives2022", back_populates="nuance")
|
||||
|
||||
|
||||
class CandidatLegislatives2022(Base):
|
||||
class Genre(enum.Enum):
|
||||
MASCULIN = "M"
|
||||
FEMININ = "F"
|
||||
|
||||
__tablename__ = "legislatives_2022_candidat"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
circonscription_id: Mapped[str] = mapped_column(ForeignKey("circonscription.id"))
|
||||
numero: Mapped[int] = mapped_column(Integer())
|
||||
nuance_id = mapped_column(ForeignKey("legislatives_2022_nuance.code"))
|
||||
bloc_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_bloc.id"))
|
||||
nom: Mapped[str] = mapped_column(String(256))
|
||||
prenom: Mapped[str] = mapped_column(String(256))
|
||||
sexe: Mapped[str] = mapped_column(Enum(Genre))
|
||||
date_naissance: Mapped[date] = mapped_column(Date())
|
||||
profession: Mapped[str] = mapped_column(String(256))
|
||||
sortant: Mapped[bool] = mapped_column(Boolean())
|
||||
nom_suppleance: Mapped[str] = mapped_column(String(256))
|
||||
prenom_suppleance: Mapped[str] = mapped_column(String(256))
|
||||
sexe_suppleance: Mapped[str] = mapped_column(Enum(Genre))
|
||||
date_naissance_suppleance: Mapped[date] = mapped_column(Date())
|
||||
sortant_suppleance: Mapped[bool] = mapped_column(Boolean())
|
||||
|
||||
circonscription: Mapped[Circonscription] = relationship(
|
||||
"Circonscription", back_populates="candidats_legislatives_2022")
|
||||
nuance: Mapped[NuanceLegislatives2022] = relationship(NuanceLegislatives2022, back_populates="candidats")
|
||||
bloc: Mapped[BlocLegislatives2022] = relationship(BlocLegislatives2022, back_populates="candidats")
|
||||
resultats_par_circonscription: Mapped[List["VoixCirconscriptionLegislatives2022"]] = relationship(
|
||||
"VoixCirconscriptionLegislatives2022", back_populates="candidat")
|
||||
resultats_par_bureau_vote: Mapped[List["VoixBureauVoteLegislatives2022"]] = relationship(
|
||||
"VoixBureauVoteLegislatives2022", back_populates="candidat")
|
||||
|
||||
|
||||
class ResultatsFranceLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_resultats_france"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
inscrits_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
inscrits_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
resultats_regions: Mapped[List["ResultatsRegionLegislatives2022"]] = relationship(
|
||||
"ResultatsRegionLegislatives2022", back_populates="resultats_france")
|
||||
voix: Mapped[List["VoixFranceLegislatives2022"]] = relationship(
|
||||
"VoixFranceLegislatives2022", back_populates="resultats_france")
|
||||
|
||||
|
||||
class ResultatsRegionLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_resultats_region"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
region_id: Mapped[str] = mapped_column(ForeignKey("region.code_insee"))
|
||||
resultats_france_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_france.id"))
|
||||
inscrits_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
inscrits_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
region = relationship(Region, back_populates="resultats_legislatives_2022")
|
||||
resultats_france = relationship(ResultatsFranceLegislatives2022, back_populates="resultats_regions")
|
||||
resultats_departements: Mapped[List["ResultatsDepartementLegislatives2022"]] = relationship(
|
||||
"ResultatsDepartementLegislatives2022", back_populates="resultats_region")
|
||||
voix: Mapped[List["VoixRegionLegislatives2022"]] = relationship(
|
||||
"VoixRegionLegislatives2022", back_populates="resultats_region")
|
||||
|
||||
|
||||
class ResultatsDepartementLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_resultats_departement"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
dpt_id: Mapped[str] = mapped_column(ForeignKey("departement.code_insee"))
|
||||
resultats_region_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_region.id"), nullable=True)
|
||||
inscrits_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
inscrits_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
departement = relationship(Departement, back_populates="resultats_legislatives_2022")
|
||||
resultats_region = relationship(ResultatsRegionLegislatives2022, back_populates="resultats_departements")
|
||||
resultats_communes: Mapped[List["ResultatsCommuneLegislatives2022"]] = relationship(
|
||||
"ResultatsCommuneLegislatives2022", back_populates="resultats_departement")
|
||||
resultats_circonscriptions: Mapped[List["ResultatsCirconscriptionLegislatives2022"]] = relationship(
|
||||
"ResultatsCirconscriptionLegislatives2022", back_populates="resultats_departement")
|
||||
voix: Mapped[List["VoixDepartementLegislatives2022"]] = relationship(
|
||||
"VoixDepartementLegislatives2022", back_populates="resultats_departement")
|
||||
|
||||
|
||||
class ResultatsCirconscriptionLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_resultats_circonscription"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
circo_id: Mapped[str] = mapped_column(ForeignKey("circonscription.id"))
|
||||
resultats_departement_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_departement.id"))
|
||||
inscrits_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
inscrits_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
circonscription = relationship("Circonscription", back_populates="resultats_legislatives_2022")
|
||||
resultats_departement = relationship(ResultatsDepartementLegislatives2022,
|
||||
back_populates="resultats_circonscriptions")
|
||||
resultats_bureaux_vote: Mapped[List["ResultatsBureauVoteLegislatives2022"]] = relationship(
|
||||
"ResultatsBureauVoteLegislatives2022", back_populates="resultats_circonscription")
|
||||
voix: Mapped[List["VoixCirconscriptionLegislatives2022"]] = relationship(
|
||||
"VoixCirconscriptionLegislatives2022", back_populates="resultats_circonscription")
|
||||
|
||||
|
||||
class ResultatsCommuneLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_resultats_commune"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
commune_id: Mapped[str] = mapped_column(ForeignKey("commune.code_insee"))
|
||||
resultats_dpt_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_departement.id"))
|
||||
inscrits_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
inscrits_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
commune = relationship(Commune, back_populates="resultats_legislatives_2022")
|
||||
resultats_departement = relationship(ResultatsDepartementLegislatives2022, back_populates="resultats_communes")
|
||||
resultats_bureaux_vote: Mapped[List["ResultatsBureauVoteLegislatives2022"]] = relationship(
|
||||
"ResultatsBureauVoteLegislatives2022", back_populates="resultats_commune")
|
||||
voix: Mapped[List["VoixCommuneLegislatives2022"]] = relationship(
|
||||
"VoixCommuneLegislatives2022", back_populates="resultats_commune")
|
||||
|
||||
|
||||
class ResultatsBureauVoteLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_resultats_bureau_vote"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
bv_id: Mapped[str] = mapped_column(ForeignKey("bureau_vote.id"))
|
||||
resultats_commune_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_commune.id"))
|
||||
resultats_circo_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_circonscription.id"),
|
||||
nullable=True)
|
||||
inscrits_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
inscrits_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
votants_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
abstentions_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
exprimes_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
blancs_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
nuls_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
bureau_vote = relationship("BureauVote", back_populates="resultats_legislatives_2022")
|
||||
resultats_commune = relationship(ResultatsCommuneLegislatives2022, back_populates="resultats_bureaux_vote")
|
||||
resultats_circonscription = relationship(ResultatsCirconscriptionLegislatives2022,
|
||||
back_populates="resultats_bureaux_vote")
|
||||
voix: Mapped[List["VoixBureauVoteLegislatives2022"]] = relationship(
|
||||
"VoixBureauVoteLegislatives2022", back_populates="resultats_bureau_vote")
|
||||
|
||||
|
||||
class VoixFranceLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_voix_france"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_nuance.code"))
|
||||
resultats_france_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_france.id"),
|
||||
primary_key=True)
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2022] = relationship(
|
||||
NuanceLegislatives2022, back_populates="resultats_nationaux")
|
||||
resultats_france: Mapped[ResultatsFranceLegislatives2022] = relationship(
|
||||
ResultatsFranceLegislatives2022, back_populates="voix")
|
||||
|
||||
|
||||
class VoixRegionLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_voix_region"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_nuance.code"))
|
||||
resultats_region_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_region.id"),
|
||||
primary_key=True)
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2022] = relationship(
|
||||
NuanceLegislatives2022, back_populates="resultats_par_region")
|
||||
resultats_region: Mapped[ResultatsRegionLegislatives2022] = relationship(
|
||||
ResultatsRegionLegislatives2022, back_populates="voix")
|
||||
|
||||
|
||||
class VoixDepartementLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_voix_departement"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_nuance.code"))
|
||||
resultats_departement_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_departement.id"),
|
||||
primary_key=True)
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2022] = relationship(
|
||||
NuanceLegislatives2022, back_populates="resultats_par_departement")
|
||||
resultats_departement: Mapped[ResultatsDepartementLegislatives2022] = relationship(
|
||||
ResultatsDepartementLegislatives2022, back_populates="voix")
|
||||
|
||||
|
||||
class VoixCirconscriptionLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_voix_circonscription"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
candidat_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_candidat.id"))
|
||||
resultats_circonscription_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("legislatives_2022_resultats_circonscription.id"), primary_key=True)
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
candidat: Mapped[CandidatLegislatives2022] = relationship(
|
||||
CandidatLegislatives2022, back_populates="resultats_par_circonscription")
|
||||
resultats_circonscription: Mapped[ResultatsCirconscriptionLegislatives2022] = relationship(
|
||||
ResultatsCirconscriptionLegislatives2022, back_populates="voix")
|
||||
|
||||
|
||||
class VoixCommuneLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_voix_commune"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[str] = mapped_column(ForeignKey("legislatives_2022_nuance.code"))
|
||||
resultats_commune_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_commune.id"),
|
||||
primary_key=True)
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2022] = relationship(
|
||||
NuanceLegislatives2022, back_populates="resultats_par_commune")
|
||||
resultats_commune: Mapped[ResultatsCommuneLegislatives2022] = relationship(
|
||||
ResultatsCommuneLegislatives2022, back_populates="voix")
|
||||
|
||||
|
||||
class VoixBureauVoteLegislatives2022(Base):
|
||||
__tablename__ = "legislatives_2022_voix_bureau_vote"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
candidat_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_candidat.id"))
|
||||
resultats_bureau_vote_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2022_resultats_bureau_vote.id"),
|
||||
primary_key=True)
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
candidat: Mapped[CandidatLegislatives2022] = relationship(CandidatLegislatives2022,
|
||||
back_populates="resultats_par_bureau_vote")
|
||||
resultats_bureau_vote: Mapped[ResultatsBureauVoteLegislatives2022] = relationship(
|
||||
ResultatsBureauVoteLegislatives2022, back_populates="voix")
|
Reference in New Issue
Block a user