dominno / django-moderation

django-moderation is reusable application for Django framework, that allows to moderate any model objects.
BSD 3-Clause "New" or "Revised" License
269 stars 91 forks source link

The moderation doesn't work #47

Closed martinzugnoni closed 11 years ago

martinzugnoni commented 12 years ago

Hi everyone! I'm trying the django-moderation app in a web system, but I can not make it work. I have made all the steps that are explained in the documentation, but there is something wrong. There is no errors. But when I save a moderated Model, it is directly saved in the Model's table, and not in the moderatedobject table. I have correctly configurated the settings.py options. I have created the moderator.py file in my app's directory and putted there the registration code. I have imported and run the auto_discover script. But nothing happens. Can someone help me? Thank you so much!

Martin.-

treyhunner commented 12 years ago

It would help to see your moderator.py and the auto_discover in your urls.py file.

Also did you remember to add moderation to INSTALLED_APPS?

martinzugnoni commented 12 years ago

Moderator.py =================================

from moderation import moderation from buscador.models import Linea moderation.register(Linea)

urls.py (main) =================================

from django.conf.urls.defaults import patterns, include, url from django.contrib import admin from moderation.helpers import auto_discover

admin.autodiscover() auto_discover()

urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^buscador/', include('buscador.urls'),name='buscador'), )

Settings.py =================================

INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles',

Uncomment the next line to enable the admin:

'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'moderation',

)

Thanks!

treyhunner commented 12 years ago

Are you testing with non-staff users? GenericModerator, the default moderation class, sets auto_approve_for_superusers and auto_approve_for_staff to True by default.

If you don't like any of the default options I'd recommend creating your own moderator as an extension of GenericModerator and changing the default options to suit your application.

dominno commented 12 years ago

@martinzugnoni Does above answer solves your problem ?

gdsaxton commented 12 years ago

I'm having the same issue. Any resolution? I have tried the same as @martinzugnoni above to no avail.

I have also tried having the following in moderator.py but this doesn't work either:

from moderation import moderation from journals.outlets.models import Article

moderation.register(Article)

from moderation.moderator import GenericModerator

class ArticleModerator(GenericModerator): notify_user = False auto_approve_for_superusers = False auto_approve_for_staff = False

moderation.register(Article, ArticleModerator)

ghost commented 11 years ago

This works well for me, @gdsaxton. Did you remember to import your moderations somewhere (I do it in in my main urls.py, although this makes pyflakes complain about an unused import) so the moderator.register call actually gets executed?

moderations.py =================================

from django.contrib.comments.moderation import CommentModerator, moderator from mydjangoapps.news.models import NewsItem

class NewsItemModerator(CommentModerator): email_notification = True moderate_after = 0 # always require approval close_after = 365 auto_moderate_field = 'published' auto_close_field = 'published' enable_field = 'enable_comments' moderator.register(NewsItem, NewsItemModerator)

urls.py (main) =================================

[...] import moderations [...]

gdsaxton commented 11 years ago

Thanks, @gazinyork -- let me give that a whirl and see if it works.