add reference from Volume to Issue and Comic
This commit is contained in:
@@ -68,6 +68,7 @@ class Volume(Base, BaseMixin):
|
||||
name = Column(String, nullable=False)
|
||||
comic_id = Column(String, ForeignKey("comic.id"), nullable=False)
|
||||
comic = relationship("Comic", back_populates="volumes")
|
||||
story_arcs = relationship("StoryArc")
|
||||
issues = relationship("Issue")
|
||||
|
||||
|
||||
@@ -85,6 +86,9 @@ class StoryArc(Base, BaseMixin):
|
||||
name = Column(String, nullable=False)
|
||||
comic_id = Column(String, ForeignKey("comic.id"), nullable=False)
|
||||
comic = relationship("Comic", back_populates="story_arcs")
|
||||
volume_id = Column(String, ForeignKey("volume.id"), nullable=True)
|
||||
volume = relationship("Volume", back_populates="story_arcs")
|
||||
issues = relationship("Issue")
|
||||
|
||||
|
||||
class Issue(Base, BaseMixin):
|
||||
@@ -96,7 +100,8 @@ class Issue(Base, BaseMixin):
|
||||
comic = relationship("Comic", back_populates="issues")
|
||||
volume_id = Column(String, ForeignKey("volume.id"), nullable=True)
|
||||
volume = relationship("Volume", back_populates="issues")
|
||||
|
||||
story_arc_id = Column(String, ForeignKey("story_arc.id"), nullable=True)
|
||||
story_arc = relationship("StoryArc", back_populates="issues")
|
||||
|
||||
class Artist(Base, BaseMixin):
|
||||
__tablename__ = "artist"
|
||||
|
||||
@@ -46,6 +46,28 @@
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if comic.volumes|length > 0 %}
|
||||
<tr>
|
||||
<th scope="row">Volumes</th>
|
||||
<td colspan="2">
|
||||
<ul>
|
||||
{% for volume in comic.volumes %}
|
||||
<li><a href="/comic/volumes/{{volume.id}}">{{volume.name}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th scope="row">Issues</th>
|
||||
<td colspan="2">
|
||||
<ul>
|
||||
{% for issue in comic.sorted_issues() %}
|
||||
<li><a href="/comic/issues/{{issue.id}}">{{issue.issue_number}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Data Created</th>
|
||||
<td colspan="2">{{comic.created_date}}</td>
|
||||
@@ -58,16 +80,6 @@
|
||||
<th scope="row">Data Version</th>
|
||||
<td colspan="2">{{comic.version}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Issues</th>
|
||||
<td colspan="2">
|
||||
<ul>
|
||||
{% for issue in comic.sorted_issues() %}
|
||||
<li><a href="/comic/issues/{{issue.id}}">{{issue.issue_number}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user