Having trouble getting a queryset to re-query the database and get
updated results.

Tried evaluating queryset in list and boolean context, no joy, always
get the same results even though the database has changed. A bit of a
newbie - am I missing something simple?

[user@box dspider]# python manage.py shell
Python 2.6.7 (r267:88850, Jun  4 2011, 04:33:59)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import spider.models as mymodel
>>> test1=mymodel.Rawurl.objects.filter(actualurlid__isnull = True)
>>> test1.count()
64
>>> test1[0].id
5858L

# so I have 64 matching records, and the first one has id field = 5858
# now I go into SQL in my other window, and set actualurlid to -1 for
that record
# do select count(*) where that field is null and get 63
# now I try again in the shell

>>> test2=mymodel.Rawurl.objects.filter(actualurlid__isnull = True)
>>> test2.count()
64
>>> test2[0].id
5858L
>>> list2 = list(mymodel.Rawurl.objects.filter(actualurlid__isnull = True))
>>> len(list2)
64
>>> list2[0].id
5858L

didn't pick up the change, even when I access queryset in a list
context.
I restart the shell and try again, and this time I get 63 results -
doesn't seem to be a problem with the code, pointing to wrong DB or
something.

Tried every other way I could think of. Any idea what I have to do to
force it to requery the database?

running on Amazon EC2 (CentOS)
python26.i686                       2.6.7-1.36.amzn1
mysql-server.i686                   5.1.52-1.6.amzn1
MySQL-python.i686                   1.2.3-0.3.c1.1.6.amzn1
Django 1.3.1

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

Reply via email to