Import candidat⋅es législatives 2024
This commit is contained in:
@ -2,3 +2,4 @@ from .base import Base
|
||||
from .geographie import *
|
||||
from .legislatives2022 import *
|
||||
from .europeennes2024 import *
|
||||
from .legislatives2024 import *
|
||||
|
@ -17,6 +17,7 @@ class Region(Base):
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsRegionLegislatives2022", back_populates="region")
|
||||
resultats_europeennes_2024 = relationship("ResultatsRegionEuropeennes2024", back_populates="region")
|
||||
resultats_legislatives_2024 = relationship("ResultatsRegionLegislatives2024", back_populates="region")
|
||||
|
||||
|
||||
class Departement(Base):
|
||||
@ -33,6 +34,7 @@ class Departement(Base):
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsDepartementLegislatives2022", back_populates="departement")
|
||||
resultats_europeennes_2024 = relationship("ResultatsDepartementEuropeennes2024", back_populates="departement")
|
||||
resultats_legislatives_2024 = relationship("ResultatsDepartementLegislatives2024", back_populates="departement")
|
||||
|
||||
|
||||
class Commune(Base):
|
||||
@ -48,6 +50,7 @@ class Commune(Base):
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsCommuneLegislatives2022", back_populates="commune")
|
||||
resultats_europeennes_2024 = relationship("ResultatsCommuneEuropeennes2024", back_populates="commune")
|
||||
resultats_legislatives_2024 = relationship("ResultatsCommuneLegislatives2024", back_populates="commune")
|
||||
|
||||
|
||||
class Circonscription(Base):
|
||||
@ -63,9 +66,12 @@ class Circonscription(Base):
|
||||
|
||||
candidats_legislatives_2022 = relationship("CandidatLegislatives2022", back_populates="circonscription")
|
||||
resultats_legislatives_2022 = relationship("ResultatsCirconscriptionLegislatives2022",
|
||||
back_populates="circonscription")
|
||||
back_populates="circonscription")
|
||||
resultats_europeennes_2024 = relationship("ResultatsCirconscriptionEuropeennes2024",
|
||||
back_populates="circonscription")
|
||||
candidats_legislatives_2024 = relationship("CandidatLegislatives2024", back_populates="circonscription")
|
||||
resultats_legislatives_2024 = relationship("ResultatsCirconscriptionLegislatives2024",
|
||||
back_populates="circonscription")
|
||||
|
||||
|
||||
class BureauVote(Base):
|
||||
@ -84,3 +90,4 @@ class BureauVote(Base):
|
||||
|
||||
resultats_legislatives_2022 = relationship("ResultatsBureauVoteLegislatives2022", back_populates="bureau_vote")
|
||||
resultats_europeennes_2024 = relationship("ResultatsBureauVoteEuropeennes2024", back_populates="bureau_vote")
|
||||
resultats_legislatives_2024 = relationship("ResultatsBureauVoteLegislatives2024", back_populates="bureau_vote")
|
||||
|
333
nupes/models/legislatives2024.py
Normal file
333
nupes/models/legislatives2024.py
Normal file
@ -0,0 +1,333 @@
|
||||
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 BlocLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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["CandidatLegislatives2024"]] = relationship("CandidatLegislatives2024",
|
||||
back_populates="bloc")
|
||||
|
||||
nuances: Mapped[List["NuanceLegislatives2024"]] = relationship(
|
||||
"NuanceLegislatives2024", back_populates="bloc")
|
||||
|
||||
|
||||
class NuanceLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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_2024_bloc.id"))
|
||||
|
||||
bloc: Mapped[BlocLegislatives2024] = relationship(BlocLegislatives2024, back_populates="nuances")
|
||||
|
||||
candidats: Mapped[List["CandidatLegislatives2024"]] = relationship(
|
||||
"CandidatLegislatives2024", back_populates="nuance")
|
||||
|
||||
resultats_nationaux: Mapped[List["VoixFranceLegislatives2024"]] = relationship(
|
||||
"VoixFranceLegislatives2024", back_populates="nuance")
|
||||
resultats_par_region: Mapped[List["VoixRegionLegislatives2024"]] = relationship(
|
||||
"VoixRegionLegislatives2024", back_populates="nuance")
|
||||
resultats_par_departement: Mapped[List["VoixDepartementLegislatives2024"]] = relationship(
|
||||
"VoixDepartementLegislatives2024", back_populates="nuance")
|
||||
resultats_par_commune: Mapped[List["VoixCommuneLegislatives2024"]] = relationship(
|
||||
"VoixCommuneLegislatives2024", back_populates="nuance")
|
||||
|
||||
|
||||
class CandidatLegislatives2024(Base):
|
||||
class Genre(enum.Enum):
|
||||
MASCULIN = "M"
|
||||
FEMININ = "F"
|
||||
|
||||
__tablename__ = "legislatives_2024_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[str] = mapped_column(ForeignKey("legislatives_2024_nuance.code"))
|
||||
bloc_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_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_2024")
|
||||
nuance: Mapped[NuanceLegislatives2024] = relationship(NuanceLegislatives2024, back_populates="candidats")
|
||||
bloc: Mapped[BlocLegislatives2024] = relationship(BlocLegislatives2024, back_populates="candidats")
|
||||
resultats_par_circonscription: Mapped[List["VoixCirconscriptionLegislatives2024"]] = relationship(
|
||||
"VoixCirconscriptionLegislatives2024", back_populates="candidat")
|
||||
resultats_par_bureau_vote: Mapped[List["VoixBureauVoteLegislatives2024"]] = relationship(
|
||||
"VoixBureauVoteLegislatives2024", back_populates="candidat")
|
||||
|
||||
|
||||
class ResultatsFranceLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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["ResultatsRegionLegislatives2024"]] = relationship(
|
||||
"ResultatsRegionLegislatives2024", back_populates="resultats_france")
|
||||
voix: Mapped[List["VoixFranceLegislatives2024"]] = relationship(
|
||||
"VoixFranceLegislatives2024", back_populates="resultats_france")
|
||||
|
||||
|
||||
class ResultatsRegionLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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_2024_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_2024")
|
||||
resultats_france = relationship(ResultatsFranceLegislatives2024, back_populates="resultats_regions")
|
||||
resultats_departements: Mapped[List["ResultatsDepartementLegislatives2024"]] = relationship(
|
||||
"ResultatsDepartementLegislatives2024", back_populates="resultats_region")
|
||||
voix: Mapped[List["VoixRegionLegislatives2024"]] = relationship(
|
||||
"VoixRegionLegislatives2024", back_populates="resultats_region")
|
||||
|
||||
|
||||
class ResultatsDepartementLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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_2024_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_2024")
|
||||
resultats_region = relationship(ResultatsRegionLegislatives2024, back_populates="resultats_departements")
|
||||
resultats_communes: Mapped[List["ResultatsCommuneLegislatives2024"]] = relationship(
|
||||
"ResultatsCommuneLegislatives2024", back_populates="resultats_departement")
|
||||
resultats_circonscriptions: Mapped[List["ResultatsCirconscriptionLegislatives2024"]] = relationship(
|
||||
"ResultatsCirconscriptionLegislatives2024", back_populates="resultats_departement")
|
||||
voix: Mapped[List["VoixDepartementLegislatives2024"]] = relationship(
|
||||
"VoixDepartementLegislatives2024", back_populates="resultats_departement")
|
||||
|
||||
|
||||
class ResultatsCirconscriptionLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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_2024_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_2024")
|
||||
resultats_departement = relationship(ResultatsDepartementLegislatives2024,
|
||||
back_populates="resultats_circonscriptions")
|
||||
resultats_bureaux_vote: Mapped[List["ResultatsBureauVoteLegislatives2024"]] = relationship(
|
||||
"ResultatsBureauVoteLegislatives2024", back_populates="resultats_circonscription")
|
||||
voix: Mapped[List["VoixCirconscriptionLegislatives2024"]] = relationship(
|
||||
"VoixCirconscriptionLegislatives2024", back_populates="resultats_circonscription")
|
||||
|
||||
|
||||
class ResultatsCommuneLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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_2024_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_2024")
|
||||
resultats_departement = relationship(ResultatsDepartementLegislatives2024, back_populates="resultats_communes")
|
||||
resultats_bureaux_vote: Mapped[List["ResultatsBureauVoteLegislatives2024"]] = relationship(
|
||||
"ResultatsBureauVoteLegislatives2024", back_populates="resultats_commune")
|
||||
voix: Mapped[List["VoixCommuneLegislatives2024"]] = relationship(
|
||||
"VoixCommuneLegislatives2024", back_populates="resultats_commune")
|
||||
|
||||
|
||||
class ResultatsBureauVoteLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_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_2024_resultats_commune.id"))
|
||||
resultats_circo_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_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_2024")
|
||||
resultats_commune = relationship(ResultatsCommuneLegislatives2024, back_populates="resultats_bureaux_vote")
|
||||
resultats_circonscription = relationship(ResultatsCirconscriptionLegislatives2024,
|
||||
back_populates="resultats_bureaux_vote")
|
||||
voix: Mapped[List["VoixBureauVoteLegislatives2024"]] = relationship(
|
||||
"VoixBureauVoteLegislatives2024", back_populates="resultats_bureau_vote")
|
||||
|
||||
|
||||
class VoixFranceLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_voix_france"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[str] = mapped_column(ForeignKey("legislatives_2024_nuance.code"))
|
||||
resultats_france_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_resultats_france.id"))
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2024] = relationship(
|
||||
NuanceLegislatives2024, back_populates="resultats_nationaux")
|
||||
resultats_france: Mapped[ResultatsFranceLegislatives2024] = relationship(
|
||||
ResultatsFranceLegislatives2024, back_populates="voix")
|
||||
|
||||
|
||||
class VoixRegionLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_voix_region"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[str] = mapped_column(ForeignKey("legislatives_2024_nuance.code"))
|
||||
resultats_region_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_resultats_region.id"))
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2024] = relationship(
|
||||
NuanceLegislatives2024, back_populates="resultats_par_region")
|
||||
resultats_region: Mapped[ResultatsRegionLegislatives2024] = relationship(
|
||||
ResultatsRegionLegislatives2024, back_populates="voix")
|
||||
|
||||
|
||||
class VoixDepartementLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_voix_departement"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[str] = mapped_column(ForeignKey("legislatives_2024_nuance.code"))
|
||||
resultats_departement_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_resultats_departement.id"))
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2024] = relationship(
|
||||
NuanceLegislatives2024, back_populates="resultats_par_departement")
|
||||
resultats_departement: Mapped[ResultatsDepartementLegislatives2024] = relationship(
|
||||
ResultatsDepartementLegislatives2024, back_populates="voix")
|
||||
|
||||
|
||||
class VoixCirconscriptionLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_voix_circonscription"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
candidat_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_candidat.id"))
|
||||
resultats_circonscription_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("legislatives_2024_resultats_circonscription.id"))
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
candidat: Mapped[CandidatLegislatives2024] = relationship(
|
||||
CandidatLegislatives2024, back_populates="resultats_par_circonscription")
|
||||
resultats_circonscription: Mapped[ResultatsCirconscriptionLegislatives2024] = relationship(
|
||||
ResultatsCirconscriptionLegislatives2024, back_populates="voix")
|
||||
|
||||
|
||||
class VoixCommuneLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_voix_commune"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
nuance_id: Mapped[str] = mapped_column(ForeignKey("legislatives_2024_nuance.code"))
|
||||
resultats_commune_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_resultats_commune.id"))
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
nuance: Mapped[NuanceLegislatives2024] = relationship(
|
||||
NuanceLegislatives2024, back_populates="resultats_par_commune")
|
||||
resultats_commune: Mapped[ResultatsCommuneLegislatives2024] = relationship(
|
||||
ResultatsCommuneLegislatives2024, back_populates="voix")
|
||||
|
||||
|
||||
class VoixBureauVoteLegislatives2024(Base):
|
||||
__tablename__ = "legislatives_2024_voix_bureau_vote"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
candidat_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_candidat.id"))
|
||||
resultats_bureau_vote_id: Mapped[int] = mapped_column(ForeignKey("legislatives_2024_resultats_bureau_vote.id"))
|
||||
voix_t1: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
voix_t2: Mapped[int] = mapped_column(Integer(), default=0)
|
||||
|
||||
candidat: Mapped[CandidatLegislatives2024] = relationship(CandidatLegislatives2024,
|
||||
back_populates="resultats_par_bureau_vote")
|
||||
resultats_bureau_vote: Mapped[ResultatsBureauVoteLegislatives2024] = relationship(
|
||||
ResultatsBureauVoteLegislatives2024, back_populates="voix")
|
Reference in New Issue
Block a user