From 8b08e23801acf9f4512c9da7c901667a077b8ea2 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 20 Feb 2024 12:53:15 +0300 Subject: [PATCH] fixmodel --- orm/community.py | 3 ++- orm/shout.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/orm/community.py b/orm/community.py index d721cba6..0b8b6d1c 100644 --- a/orm/community.py +++ b/orm/community.py @@ -4,6 +4,7 @@ from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.orm import relationship from services.db import Base +from orm.author import Author class CommunityAuthor(Base): @@ -25,4 +26,4 @@ class Community(Base): pic = Column(String, nullable=False, default='') created_at = Column(Integer, nullable=False, default=lambda: int(time.time())) - authors = relationship('author', secondary='community_author') + authors = relationship(Author, secondary='shout_author') diff --git a/orm/shout.py b/orm/shout.py index d7d5cd86..bba8acb8 100644 --- a/orm/shout.py +++ b/orm/shout.py @@ -4,6 +4,10 @@ from sqlalchemy import JSON, Boolean, Column, ForeignKey, Integer, String from sqlalchemy.orm import relationship from services.db import Base +from orm.community import Community +from orm.author import Author +from orm.reaction import Reaction +from orm.topic import Topic class ShoutTopic(Base): @@ -67,10 +71,10 @@ class Shout(Base): layout = Column(String, nullable=False, default='article') media = Column(JSON, nullable=True) - authors = relationship('author', secondary='shout_author') - topics = relationship('topic', secondary='shout_topic') - communities = relationship('community', secondary='shout_community') - reactions = relationship('reaction') + authors = relationship(Author, secondary='shout_author') + topics = relationship(Topic, secondary='shout_topic') + communities = relationship(Community, secondary='shout_community') + reactions = relationship(Reaction) lang = Column(String, nullable=False, default='ru', comment='Language') version_of = Column(ForeignKey('shout.id'), nullable=True)