Opened 15 years ago

Closed 15 years ago

#11749 closed (invalid)

QuerySet not autmatically evaluated on attribut update?

Reported by: gz Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords: Database ORM QuerySet evaluation
Cc: gz Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Not evaluating QuerySets manually by using list() gives strange results while trying to update a model in the list:

my_list = Model.objects.all()
my_list[order].some_attribute = 12
my_list[index].save() # some_attribute is not updated!
# with my_list = list(Model.objects.all()) it works tough

I don't know if this is really a bug or intended behaviour?

Change History (2)

in reply to:  description comment:1 by gz, 15 years ago

Replying to gz:

Not evaluating QuerySets manually by using list() gives strange results while trying to update a model in the list:

my_list = Model.objects.all()
my_list[order].some_attribute = 12
my_list[index].save() # some_attribute is not updated!
# with my_list = list(Model.objects.all()) it works tough

I don't know if this is really a bug or intended behaviour?

order should be equal to index here, otherwise this example does not make sense

comment:2 by James Bennett, 15 years ago

Resolution: invalid
Status: newclosed

This is intended behavior; a QuerySet is not a list, and code which assumes it is will likely have difficulties.

Note: See TracTickets for help on using tickets.
Back to Top