Skip to content

Update (.save()) do not work if the object fetched using .filter() #70

@kishorpawar

Description

@kishorpawar
p = Person.objects.filter(name="Granny")
# Assuming only one record fetched.
p[0].first_name = "Morgan"
p[0].last_name = "Stanley"
p.save()

Above case do not update the values in DB.
even

p[0].update_attributes(first_name="Morgan", last_name="Stanley")
p[0].save()

doesn't work.

Instead following work as expected.

p = Person.objects.get_by_id('1')
p.first_name = "Morgan"
p.last_name = Stanley
p.save()

I believe this is critical issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions