Hi all,

I'd like to add a small note of warning about queryset caching in dos,
in topics/db/queries.txt "Caching and QuerySets" section,
something like:

Keep in mind when looping through a queryset and altering data that
might be returned by the same queryset, that instances might not
be "fresh".

You might want to refresh the instance before calling some table-wide 
data-altering
method on it::

    >>> for obj in Entry.objects.all():
    >>>   obj = Entry.objects.get(pk=obj.pk)
    >>>   obj.alter_some_other_entries()

Should I open a ticket or maybe it's a too specific use-case?

Cheers,

Marco

--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to