Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » pre-moderate forum posts

hi,

i am kind of new to both, django and sct and tried to set up a small forum page together with some news and so on and was impressed by the quality of this framework. i was able to prototype the whole setup in just a day or so with one or two days additional playing around to get things look nice.
i am now a bit stuck, however, as i try to figure out where i could integrate a pre modearation of forum posts to allow an administrator to approve posts before they appear in the forum. i know that this is not the usual case for cummunity driven forums ... anyway it is a requirement.
is there someone who did that already? if not, where is the best point to start hacking that approve part into the existing codebase?

thanks for every pointer in the right direction

greets
lenz

--- Last Edited by norbu09 at 2008-03-30 22:50:51 ---
i am kind of new to both, django and sct and tried to set up a small forum page together with some news and so on and was impressed by the quality of this framework. i was able to prototype the whole setup in just a day or so with one or two days additional playing around to get things look nice.
good the hear :) do you also use SCT for the news ?

i am now a bit stuck, however, as i try to figure out where i could integrate a pre modearation of forum posts to allow an administrator to approve posts before they appear in the forum. i know that


unfortunately i do not know of anyone who did that before.. although.. someone already mentioned it.. i'm not sure what happened with it though..

i don't think it is that difficult though .. i assume you are using SCT trunk ?

there is a property in the 'Post' class named 'is_hidden' which can be set to != 0 to indicate that the Post is 'not yet ready' and should be hidden from everyone... this is where you could hook into ..

may suggestion would be .. take a look at how 'sphblog' makes use of 'category types' - this way you won't have to modify any of SCT code, but instead extend it in your own application.

take a look at: http://yourhell.com/wsvn/root/django/communitytools/trunk/sphenecoll/sphene/sphblog/categorytypes.py

(SCT will go through all INSTALLED_APPS and search for the module 'categorytypes' and if it exists - it is loaded .. all classes extending '\CategoryType' are then registered as category types..)

all you would have to do is implement the method:

    def save_post(self, newpost, data):


and add your logic there.. at first.. simply set is_hidden to true:
newpost.is_hidden = 1
newpost.save()

this should make it impossible to actually add new posts..

in a second step you would need to create a custom view (preferable in your own application) which allows moderators to 'approve' posts.. and set is_hidden = 0 -- the only thing left.. would be to make sure that when you call .save() after setting is_hidden to 0 .. that it is not set back to 1 again in your save_post method :) (the easiest way would probably be to check if the current user is a moderator)

i hope that helps you a bit..
Hey, we have Signatures !!! Great, isn't it ? ;)
ahh.. another thing .. in your moderator-view .. you can't use Post.objects.filter( is_hidden = 1 ) - you have to use Post.allobjects.filter( is_hidden = 1 )
Hey, we have Signatures !!! Great, isn't it ? ;)
thanks heaps for those hints.

it looks like you can add an installation down here in new zealand to your list. i'll post you a link when it is going to happen (looks like it).

thanks,
lenz
it looks like you can add an installation down here in new zealand to your list. i'll post you a link when it is going to happen (looks like it).
great, i'm looking forward to see your site ;)

let me know if you encounter any further problems
Hey, we have Signatures !!! Great, isn't it ? ;)

Please login to post a reply.



Powered by Sphene Community Tools