Monday, May 31, 2010

Re: Item is already being moderated

On May 31, 1:41 am, shacker <shac...@birdhouse.org> wrote:

> I get "The model 'item' is already being moderated."  I haven't set up
> moderation before, so it's not clear what's triggering this. I do have
> an "enable_comments" field on the Item model. Odd that the error puts
> "item" in lowercase rather than upper.

I was able to fix this like this:

from django.contrib.comments.moderation import CommentModerator,
moderator, AlreadyModerated

....

class ItemModerator(CommentModerator):
email_notification = True
enable_field = 'enable_comments'

# moderator.register(Item, ItemModerator)

try:
moderator.register(Item, ItemModerator)
except AlreadyModerated:
pass


Not clear *why* this works, since I'm now bypassing the register step.
And it's not clear why Django thinks moderation is already registered.
Is this a bug, or a documentation oversight, or something I'm not
understanding? I do see a few blog posts and semi-related filed bugs
on this topic.

Scot

--
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