File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from lin .core import lin_config
12from lin .exception import NotFound
23from lin .interface import InfoCrud as Base
3- from sqlalchemy import Column , String , Integer
4+ from sqlalchemy import Column , String , Integer , Text
45
56
67class Poem (Base ):
78 id = Column (Integer , primary_key = True , autoincrement = True )
89 title = Column (String (50 ), nullable = False , comment = '标题' )
910 author = Column (String (50 ), default = '未名' , comment = '作者' )
1011 dynasty = Column (String (50 ), default = '位置' , comment = '朝代' )
11- content = Column (String (255 ), nullable = False , comment = '内容' )
12+ content = Column (Text , nullable = False , comment = '内容' )
13+ image = Column (String (255 ), default = '' , comment = '配图' )
1214
1315 def get_all (self ):
14- poems = self .query .filter_by (delete_time = None ).all ()
16+ poems = self .query .filter_by (delete_time = None ).limit (
17+ lin_config .get_config ('poem.limit' )
18+ ).all ()
1519 if not poems :
1620 raise NotFound (msg = '没有找到相关诗词' )
1721 return poems
Original file line number Diff line number Diff line change 1+ limit = 20
You can’t perform that action at this time.
0 commit comments