File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,9 +10,17 @@ class Poem(Base):
1010 title = Column (String (50 ), nullable = False , comment = '标题' )
1111 author = Column (String (50 ), default = '未名' , comment = '作者' )
1212 dynasty = Column (String (50 ), default = '未知' , comment = '朝代' )
13- content = Column (Text , nullable = False , comment = '内容' )
13+ _content = Column ('content' , Text , nullable = False , comment = '内容,以/来分割每一句,以|来分割宋词的上下片 ' )
1414 image = Column (String (255 ), default = '' , comment = '配图' )
1515
16+ @property
17+ def content (self ):
18+ ret = []
19+ lis = self ._content .split ('|' )
20+ for x in lis :
21+ ret .append (x .split ('/' ))
22+ return ret
23+
1624 def get_all (self , form ):
1725 query = self .query .filter_by (delete_time = None )
1826
@@ -26,6 +34,7 @@ def get_all(self, form):
2634
2735 if not poems :
2836 raise NotFound (msg = '没有找到相关诗词' )
37+
2938 return poems
3039
3140 def search (self , q ):
You can’t perform that action at this time.
0 commit comments