prophecies/core/managers.py
from actstream.managers import ActionManager, streamfrom django.contrib.contenttypes.models import ContentType class ExtendedActionManager(ActionManager): Similar blocks of code found in 3 locations. Consider refactoring. def filter_actor_params(self, actor): content_type = ContentType.objects.get_for_model(actor) id = actor.id return dict(actor_content_type=content_type, actor_object_id=id) Similar blocks of code found in 3 locations. Consider refactoring. def filter_target_params(self, target): content_type = ContentType.objects.get_for_model(target) id = target.id return dict(target_content_type=content_type, target_object_id=id) Similar blocks of code found in 3 locations. Consider refactoring. def filter_action_object_params(self, action_object): content_type = ContentType.objects.get_for_model(action_object) id = action_object.id return dict(action_object_content_type=content_type, action_object_object_id=id) @stream def filter_actor(self, actor): return self.filter(**self.filter_actor_params(actor)) @stream def filter_target(self, target): return self.filter(**self.filter_target_params(target)) @stream def filter_action_object(self, action_object): return self.filter(**self.filter_action_object_params(action_object))