Skip to content
This repository has been archived by the owner. It is now read-only.

Handle no objs #3

Merged
merged 2 commits into from Apr 28, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -36,11 +36,18 @@ def bulk_update(objs, meta=None, update_fields=None, exclude_fields=None,
using='default', batch_size=None):
assert batch_size is None or batch_size > 0

obj_count = None
# if we have a QuerySet, avoid loading objects into memory
if isinstance(objs, QuerySet):
batch_size = batch_size or objs.count()
obj_count = objs.count()
batch_size = batch_size or obj_count
else:
batch_size = batch_size or len(objs)
obj_count = len(objs)
batch_size = batch_size or obj_count

# If there are not objects to update just exit.
if obj_count == 0:
return

connection = connections[using]
if meta is None:
@@ -8,7 +8,7 @@

setup(
name='django-bulk-update',
version='1.1.2',
version='1.1.2.2',
packages=find_packages(),
include_package_data=True,
description='Bulk update using one query over Django ORM.',
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.