Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SOFT Core
SOFT 161 and 162
orm_lab
Commits
cfd503cb
Commit
cfd503cb
authored
Apr 06, 2022
by
Christopher Bohn
🤔
Browse files
Corrected updated relationships
parent
4043d37f
Changes
1
Hide whitespace changes
Inline
Side-by-side
movies.py
View file @
cfd503cb
...
...
@@ -13,7 +13,7 @@ class Movie(Persisted):
budget
=
Column
(
Integer
)
gross_revenue
=
Column
(
Integer
)
opening_date
=
Column
(
Date
)
genres
=
relationship
(
'Genre'
,
uselist
=
True
,
secondary
=
'movie_genres'
,
viewonly
=
True
)
genres
=
relationship
(
'Genre'
,
uselist
=
True
,
secondary
=
'movie_genres'
,
back_populates
=
'movies'
)
reviews
=
relationship
(
'Review'
,
uselist
=
True
,
back_populates
=
'movie'
)
...
...
@@ -30,7 +30,7 @@ class Genre(Persisted):
__tablename__
=
'genres'
genre_id
=
Column
(
Integer
,
primary_key
=
True
)
name
=
Column
(
String
(
256
),
nullable
=
False
)
movies
=
relationship
(
'Movie'
,
uselist
=
True
,
secondary
=
'movie_genres'
,
viewonly
=
True
)
movies
=
relationship
(
'Movie'
,
uselist
=
True
,
secondary
=
'movie_genres'
,
back_populates
=
'genres'
)
class
MovieGenre
(
Persisted
):
...
...
Write
Preview
Supports
Markdown
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