本文整理汇总了Python中models.Actor.last_name方法的典型用法代码示例。如果您正苦于以下问题:Python Actor.last_name方法的具体用法?Python Actor.last_name怎么用?Python Actor.last_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Actor
的用法示例。
在下文中一共展示了Actor.last_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plog
# 需要导入模块: from models import Actor [as 别名]
# 或者: from models.Actor import last_name [as 别名]
"""
ct = Actor.query.count()
plog("Actor Count via .count(): {0} ".format(ct))
"""
Demo #2
Add a new Actor to the database
Verify that it's added
"""
rick = Actor()
rick.first_name = "Rick"
rick.last_name = "Harding"
session.add(rick)
# notice that we flush here, but we don't commit. The change won't actually
# make it to the db so when we rerun this script, it'll still report 200/201
session.flush()
ct = Actor.query.count()
plog("Inserted Rick, New Count: {0} ".format(ct))
"""
Homework
Now that the new actor 'Rick' is added, remove him and verify that you get back
200 actors in the database