Wednesday, August 24, 2011

Re: Problem updating data

Instead of counting the inactive, try counting the active ones. If that count doesn't go up by one, I'd suspect something's dodgy in your Entry model's save() that means it doesn't write successfully to the db.

You could debug by doing:

from django.db import connection
connection.queries
e1.save()
connection.queries

to see what the SQL generated was.

Then start looking at your database to see what it's doing.

Malcolm

On 23 August 2011 23:08, Karen McNeil <karenlmcneil@gmail.com> wrote:
No, that's not the problem. Even if I redo the query now, I still get
the same count (see below). And, like I said, the change does not show
up in the admin either -- THE VALUE HAS NOT BEEN CHANGED.

This behavior is so unexpected I'm not sure how to even begin trouble-
shooting it.

~Karen

PS -- What's wrong with querying by "active=0"? I did it that way
because that's what the admin interface does for filters... is there
any difference?


NEW SHELL SESSION FROM TODAY, TESTING SAME THING:

>>> from dictionary.models import Entry
>>> entries = Entry.objects.filter(active=False)
>>> entries.count()
3642
>>> e1 = entries[0]
>>> e1
<Entry: إبّاخ>
>>> e1.active
False

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--
Malcolm Box
malcolm.box@gmail.com

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment