migrate main topic
This commit is contained in:
parent
c66efd5e1f
commit
eb67d6a52d
|
@ -90,7 +90,11 @@ def migrate(entry, users_by_oid, topics_by_oid):
|
||||||
# print(entry)
|
# print(entry)
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
topic_oids = set(entry['category'])
|
category = entry['category']
|
||||||
|
mainTopic = topics_by_oid.get(category)
|
||||||
|
if mainTopic:
|
||||||
|
r['mainTopic'] = mainTopic["slug"]
|
||||||
|
topic_oids = set(category)
|
||||||
topic_oids.update(entry.get("tags", []))
|
topic_oids.update(entry.get("tags", []))
|
||||||
for oid in topic_oids:
|
for oid in topic_oids:
|
||||||
if oid in topics_by_oid:
|
if oid in topics_by_oid:
|
||||||
|
|
|
@ -293,4 +293,5 @@ class Shout(Base):
|
||||||
layout: str = Column(String, nullable = True)
|
layout: str = Column(String, nullable = True)
|
||||||
authors = relationship(lambda: User, secondary=ShoutAuthor.__tablename__) # NOTE: multiple authors
|
authors = relationship(lambda: User, secondary=ShoutAuthor.__tablename__) # NOTE: multiple authors
|
||||||
topics = relationship(lambda: Topic, secondary=ShoutTopic.__tablename__)
|
topics = relationship(lambda: Topic, secondary=ShoutTopic.__tablename__)
|
||||||
|
mainTopic = Column(ForeignKey("topic.slug"), nullable=True)
|
||||||
visibleFor = relationship(lambda: User, secondary=ShoutViewer.__tablename__)
|
visibleFor = relationship(lambda: User, secondary=ShoutViewer.__tablename__)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user