Customising comment framework and keeping moderation working

Skip to first unread message

Phil Gyford

Oct 5, 2010, 6:27:00 AM10/5/10

I can't get my extended version of django.contrib.comments to take
notice of moderation.

If I use the standard comments framework, then my subclass of
CommentModerator does the job - I've just used it to define
enable_field, and this allows or prohibits comments as expected.

But if I switch to using my custom version of the comments framework
(which adds an extra field) it seems like the moderator is ignored -
all comments are allowed through, no matter whether the enable_field
on the commented-on object is true or false.

I can't see what I'm missing. Here's the code for my moderator, in
case it helps: It works fine like that, with
the standard framework, but if I switch the import lines over, add my
custom comments app to INSTALLED_APPS and COMMENTS_APP settings, the
enable_field has no effect.

What's the magical missing step....? Thanks.



Phil Gyford

Oct 5, 2010, 9:46:17 AM10/5/10
I've investigated further and... it's very strange.

I've got a version of my custom comments framework, with
enable_comments moderation, working fine. Here are the contents of my
working customcomments/ and customcomments/

However, if I add "from weblog.models import Blog" to either of those
files, my custom moderation has no effect.

This is a problem, because what I really want to do is not add a
'title' field to each custom comment, but add a ForeignKey field that
links to the Blog object (comments are posted on Entries, each of
which is associated with a Blog). So I will need to import the Blog

In case it helps, here's the contents of weblog/ that
contains the Blog class:

This modification really isn't worth the two days I've now spent
puzzling over it, but it's got personal, and I just want to understand
the solution now! Any help very much appreciated.


Phil Gyford

Oct 5, 2010, 10:36:34 AM10/5/10
I've made as minimal a complete demonstration of this as possible, to
try and work out where I'm going wrong:

It works fine: comments can successfully be disabled on a per-Entry
basis. But, if you add "from weblog.models import Entry" to either
customcomments/ or customcomments/ then comments are
*always* allowed through. Any idea why? Thanks.


Klaas van Schelven

Oct 6, 2010, 4:06:47 AM10/6/10
to Django users

A quick reply so I may be wrong on the details.
I think you're running into a limitation on the standard way of doing
things in Django.

I've talked about this before here:

and here:

no time for a full reply here but if it's gotten personal this might
help you a bit,

> >> case it helps: works fine like that, with

Phil Gyford

Oct 6, 2010, 5:14:56 AM10/6/10
Thanks Klaas. That second one does seem related to my problem although
after a couple of days struggling with this issue I'm now at the
limits of my knowledge and don't know if it actually helps me :)

I found what seems like a related ticket that's been opened and closed
a couple of times and tentatively re-opened it with an explanation:

I'm going to have to move on though and try and work around the
problem for now as this frustration is doing me no good at all :(


> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to
> To unsubscribe from this group, send email to
> For more options, visit this group at


Reply all
Reply to author
0 new messages