按建立时间倒序查询测试用例python
>>> a= TestCase.query.order_by(TestCase.create_time.desc()).first() >>> a <TestCase.首页查看所有xxx>
注意 order_by()括号中的写法:测试
直接写creater_time.desc()会报AttributeErrorui
>>> a= TestCase.query.order_by(id.desc()).first() Traceback (most recent call last): File "/usr/lib/python3.6/code.py", line 91, in runcode exec(code, self.locals) File "<console>", line 1, in <module> AttributeError: 'builtin_function_or_method' object has no attribute 'desc'
正确的写法是TestCase.creater_time.desc()spa