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 90 forks source link

All objects always available, even if rejected or unapproved... #133

Closed ursomniac closed 4 years ago

ursomniac commented 9 years ago

I'm trying to do a parallel test from the shell to what's in the docs.

from myapp.models import Event ee = Event(title='foo', date='2015-06-01', start_time='12:00:00') ee.save() ee.pk 17L

As I understand it, this should be unapproved and the follow should NOT happen.

z = Event.objects.get(pk=17)

z <Event: 17: 2015-06-01 | foo>

According to the docs, this SHOULD return: Traceback (most recent call last): DoesNotExist: YourModel matching query does not exist.

Also, rejected items likewise also return (e.g., a rejected item has pk=9)

z = Event.objects.get(pk=9)

z <Event: 9: 2015-06-01 | REJECTED!>

Thoughts? Suggestions?

ryuusenshi commented 9 years ago

Are you sure you've created moderator.py, registered the model and ran auto_discover() in your project level urls.py?

ursomniac commented 9 years ago

Yup. I'm looking at the code in the repo here and it doesn't match my local copy. I suspect that I'm a rev behind (I'm using Django 1.7 which is likely relevant since the newest rev deals with 1.7 support).

ursomniac commented 9 years ago

I've backed out to Django 1.6. It ALMOST works, but it appears that the problem (the original one I posted) is that visible_until_rejected is not being honored. I have this moderator class defined:

class EventModerator(GenericModerator): notify_user = False notify_moderator = False auto_approve_for_superusers = True auto_approve_for_staff = False visible_until_rejected = False

But an Event that is created by a user who is staff-only shows up in the Event table. It DOES also appear in the moderation_moderated table correctly ('pending'). In the User table, the user has permissions "event | event | Can add event" and "event | event | Can change event" set --- is that an error on my part (and if so, what's the correct set of user permissions since if I don't have them set, I get the "You don't have permission to edit anything" error).

Also, if a superuser REJECTS an Event, the Event ALSO still appears in the event_event table.

DmytroLitvinov commented 4 years ago

We have a new version of django-moderation which does not have such problem.