-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't access moderated object attributes #134
Comments
What's happening is that your models are not getting registered. To check which models are registered you can do: from moderation import moderation
print moderation._registered_models If you get an empty dict, it's because you haven't registered any models. Now if you have In order for your models to properly register, you should do this before you do anything else in you shell session: from moderation.helpers import auto_discover
auto_discover() This might fix all the other problems you've been having, as well. |
I got the Created a |
@ursomniac Did this fix your problems? I'm unable to reproduce the problem. |
@ryuusenshi Yes - things are behaving properly in the shell now - THANKS! BUT - you still can get the behavior I described if you go through the Django admin. (i.e., non-superuser user creates an object that immediately goes live). This isn't ABSOLUTELY critical (because I'm not intending to let anyone but superusers to have access to the Django Admin), but I'd like to know what - if anything - I'm doing wrong. (and thanks for your patience!) |
I'm back to square 1. If I incorporate Django REST framework, it ignores django-moderation: Event objects created through moderation - though 'pending' - appear in the Event table. HOWEVER, using moderation in the shell returns the "correct" results (i,e., Event.objects.all() only returns approved objects) even though there are objects in the Event table that are unapproved. |
from your_app.models import MyModel
foo = MyModel.objects.get(pk=1)
foo.dict
{ ... all the things... }
foo.moderated_object.changed_object.dict
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'MyModel' object has no attribute 'moderated_object'
This doesn't match the behavior in the "How django-moderation works" part of the docs.
The text was updated successfully, but these errors were encountered: