Closed ouhouhsami closed 4 years ago
I don't know if it's planned but I like the idea.
About class based views and Managers
One thing I would like to discuss with you; if I have a model with a custom manager set like this:
objects = models.GeoManager() #for instance, it could be another custom manager of course
when I run auto_discover(), will my manager be 'wrapped' with the ModerationObjectManager. I ask you this, because, in my class based views (a DetailView), I must redefine the queryset like this:
def get_queryset(self):
return self.model.objects.filter(_relation_object__moderation_status = 1)
(this is a first idea to implement a django-moderation mixin for class based views) but I thought that autodiscover process would have automatically ad this filter with it manager.
About actual Manager
Moreover, when working with django-moderation, I think the manager could be a little more smarter based on 'changed_by' field, when filtering objects:
if my_instance.changed_by == request.user:
return current changed_object #so that we can edit it with form and current values, without having to retrieve it using unmoderated_objects manager
else:
return old object or 404 if not moderated #... and other filtering stuff
What are you point of view about this 2 cases ?
It seems that just
def get_queryset(self):
return self.model.objects.all()
works
Closed because of inactivity.
Hello,
I would be interested in a class based views kind of django-moderation helpers. Are you planning to provide a mixin, or something like this, for django-moderation to be used in class based views.
Regards,