Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't update deferred fields #56

Merged
merged 3 commits into from
May 23, 2017
Merged

Conversation

arnau126
Copy link
Collaborator

@arnau126 arnau126 commented May 23, 2017

If update_fields is not specified, only update not-deferred fields.

Usage example:

people = People.objects.all().only('age', 'name')
for person in people:
    person.age += 1
    person.name = 'John'
People.objects.bulk_update(people)

which it is equivalent (but less efficient) to:

people = People.objects.all()
for person in people:
    person.age += 1
    person.name = 'John'
People.objects.bulk_update(people, update_field=['age', 'name'])

@aykut
Copy link
Owner

aykut commented May 23, 2017

Many thanks, another great PR.

@aykut aykut merged commit 7fea2b5 into aykut:master May 23, 2017
@arnau126 arnau126 deleted the deferred_fields branch May 24, 2017 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants