custom save method
super(YourClass, self).save(*args, **kwargs)
On 26 Sie, 03:59, Karen McNeil <karenlmcn...@gmail.com> wrote:
> Thank you Malcolm, you were exactly right!
>
> I would have never thought of that, but I have a custom save method
> and when I commented it out and restarted the app, setting the active
> property worked just as expected. Now I just have to figure out what
> the hell is wrong with my save method... :-)
>
> Thank you!
>
> ~Karen
>
> On Aug 24, 8:31 pm, Malcolm Box <malcolm....@gmail.com> wrote:
>
>
>
>
>
>
>
> > 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 <karenlmcn...@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....@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