fix section view
This commit is contained in:
@@ -10,11 +10,6 @@ import flask
|
||||
|
||||
#from src.articles import Article
|
||||
|
||||
class SectionSchema(Schema):
|
||||
id=fields.Integer()
|
||||
foreign_name=fields.String()
|
||||
name=fields.String()
|
||||
|
||||
class Section(Base):
|
||||
__tablename__ = 'sections'
|
||||
id = Column(Integer, primary_key=True)
|
||||
@@ -48,3 +43,24 @@ class Section(Base):
|
||||
db_session.add(s)
|
||||
db_session.commit()
|
||||
return s
|
||||
|
||||
|
||||
class ArticleCompSchema(Schema):
|
||||
id=fields.Integer()
|
||||
# text=fields.String()
|
||||
title=fields.String()
|
||||
author=fields.String()
|
||||
sourcetype =fields.String()
|
||||
image =fields.String()
|
||||
url =fields.String()
|
||||
published_date=fields.DateTime()
|
||||
date=fields.DateTime()
|
||||
first_fetched=fields.DateTime()
|
||||
section_id=fields.Integer()
|
||||
|
||||
#from src.articles.model import ArticleCompSchema
|
||||
class SectionSchema(Schema):
|
||||
id=fields.Integer()
|
||||
foreign_name=fields.String()
|
||||
name=fields.String()
|
||||
articles=fields.Nested(ArticleCompSchema,many=True)
|
||||
|
||||
Reference in New Issue
Block a user