浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Django | QuerySet API reference | Django documentation

bulk_create

bulk_create(objs)
New in Django 1.4: Please see the release notes

This method inserts the provided list of objects into the database in an
efficient manner (generally only 1 query, no matter how many objects there
are):

>>> Entry.objects.bulk_create([
...     Entry(headline="Django 1.0 Released"),
...     Entry(headline="Django 1.1 Announced"),
...     Entry(headline="Breaking: Django is awesome")
... ])

This has a number of caveats though:

    posted on 2012-04-23 16:03  lexus  阅读(282)  评论(0)    收藏  举报