Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
parlapi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Guillot
parlapi
Commits
63fb1db5
Commit
63fb1db5
authored
Mar 30, 2017
by
David Guillot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Model] Ajout de la relation ActeurAmendement
parent
1b9de7c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
1 deletion
+52
-1
migrations/versions/9312f57cabaf_.py
migrations/versions/9312f57cabaf_.py
+36
-0
parlapi/models.py
parlapi/models.py
+16
-1
No files found.
migrations/versions/9312f57cabaf_.py
0 → 100644
View file @
63fb1db5
"""empty message
Revision ID: 9312f57cabaf
Revises: 55c1e64eaf9f
Create Date: 2017-03-30 14:56:51.669999
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'9312f57cabaf'
down_revision
=
'55c1e64eaf9f'
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
create_table
(
'acteurs_amendements'
,
sa
.
Column
(
'id'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
Column
(
'relation'
,
sa
.
Unicode
(),
nullable
=
True
),
sa
.
Column
(
'acteur_id'
,
sa
.
Unicode
(),
nullable
=
True
),
sa
.
Column
(
'amendement_id'
,
sa
.
Unicode
(),
nullable
=
True
),
sa
.
ForeignKeyConstraint
([
'acteur_id'
],
[
'acteurs.id'
],
),
sa
.
ForeignKeyConstraint
([
'amendement_id'
],
[
'amendements.id'
],
),
sa
.
PrimaryKeyConstraint
(
'id'
)
)
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_table
(
'acteurs_amendements'
)
# ### end Alembic commands ###
parlapi/models.py
View file @
63fb1db5
...
...
@@ -170,6 +170,7 @@ class Acteur(db.Model):
mandats
=
db
.
relationship
(
'Mandat'
,
back_populates
=
'acteur'
)
documents
=
db
.
relationship
(
'ActeurDocument'
,
back_populates
=
'acteur'
)
dossiers
=
db
.
relationship
(
'ActeurDossier'
,
back_populates
=
'acteur'
)
amendements
=
db
.
relationship
(
'ActeurAmendement'
,
back_populates
=
'acteur'
)
search_vector
=
db
.
Column
(
TSVectorType
(
'civilite'
,
'nom'
,
'prenom'
,
'profession'
))
...
...
@@ -407,7 +408,6 @@ class Amendement(db.Model):
date_distribution
=
db
.
Column
(
db
.
Date
)
# TODO référence séance json['seanceDiscussion']
# TODO auteurs/cosignataires
legislature_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'legislatures.id'
))
legislature
=
db
.
relationship
(
'Legislature'
,
back_populates
=
'amendements'
)
...
...
@@ -423,11 +423,26 @@ class Amendement(db.Model):
backref
=
db
.
backref
(
'amendement_parent'
,
remote_side
=
[
id
]))
acteurs
=
db
.
relationship
(
'ActeurAmendement'
,
back_populates
=
'amendement'
)
search_vector
=
db
.
Column
(
TSVectorType
(
'numero_long'
,
'corps_expose'
,
'corps_dispositif'
,
'code_loi'
,
'code_loi_division'
))
class
ActeurAmendement
(
db
.
Model
):
__tablename__
=
'acteurs_amendements'
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
relation
=
db
.
Column
(
db
.
Unicode
)
acteur_id
=
db
.
Column
(
db
.
Unicode
,
db
.
ForeignKey
(
'acteurs.id'
))
acteur
=
db
.
relationship
(
'Acteur'
,
back_populates
=
'amendements'
)
amendement_id
=
db
.
Column
(
db
.
Unicode
,
db
.
ForeignKey
(
'amendements.id'
))
amendement
=
db
.
relationship
(
'Amendement'
,
back_populates
=
'acteurs'
)
class
Scrutin
(
db
.
Model
):
__tablename__
=
'scrutins'
query_class
=
SearchableQuery
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment