This commit is contained in:
parent
6377bc3d64
commit
8b08e23801
|
@ -4,6 +4,7 @@ from sqlalchemy import Column, ForeignKey, Integer, String
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from services.db import Base
|
from services.db import Base
|
||||||
|
from orm.author import Author
|
||||||
|
|
||||||
|
|
||||||
class CommunityAuthor(Base):
|
class CommunityAuthor(Base):
|
||||||
|
@ -25,4 +26,4 @@ class Community(Base):
|
||||||
pic = Column(String, nullable=False, default='')
|
pic = Column(String, nullable=False, default='')
|
||||||
created_at = Column(Integer, nullable=False, default=lambda: int(time.time()))
|
created_at = Column(Integer, nullable=False, default=lambda: int(time.time()))
|
||||||
|
|
||||||
authors = relationship('author', secondary='community_author')
|
authors = relationship(Author, secondary='shout_author')
|
||||||
|
|
12
orm/shout.py
12
orm/shout.py
|
@ -4,6 +4,10 @@ from sqlalchemy import JSON, Boolean, Column, ForeignKey, Integer, String
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from services.db import Base
|
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):
|
class ShoutTopic(Base):
|
||||||
|
@ -67,10 +71,10 @@ class Shout(Base):
|
||||||
layout = Column(String, nullable=False, default='article')
|
layout = Column(String, nullable=False, default='article')
|
||||||
media = Column(JSON, nullable=True)
|
media = Column(JSON, nullable=True)
|
||||||
|
|
||||||
authors = relationship('author', secondary='shout_author')
|
authors = relationship(Author, secondary='shout_author')
|
||||||
topics = relationship('topic', secondary='shout_topic')
|
topics = relationship(Topic, secondary='shout_topic')
|
||||||
communities = relationship('community', secondary='shout_community')
|
communities = relationship(Community, secondary='shout_community')
|
||||||
reactions = relationship('reaction')
|
reactions = relationship(Reaction)
|
||||||
|
|
||||||
lang = Column(String, nullable=False, default='ru', comment='Language')
|
lang = Column(String, nullable=False, default='ru', comment='Language')
|
||||||
version_of = Column(ForeignKey('shout.id'), nullable=True)
|
version_of = Column(ForeignKey('shout.id'), nullable=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user