def rating_handler(sender, instance, created, **kwargs): # fall back on the rating user if no request user is found (for tests) actor = user() or instance.user target = instance.content_object act = action(actor, verb='rated', action_object=instance, target=target) if actor != target.owner: target.owner.useractivity.other_actor_actions.add(act)
def handler(sender, instance, created, **kwargs): if created and not create_verb: return try: publish = getattr(instance, 'publish', None) except PublishingStatus.DoesNotExist: publish = None if publish and publish.status != 'Public': return active_verb = create_verb if created else update_verb actor = instance action_object = None if provide_user: actor = user() if not actor: # a non request caused this return action_object = instance action(actor, verb=active_verb, action_object=action_object)
def handler(sender, instance, created, **kwargs): if created and not create_verb: return try: publish = getattr(instance, 'publish', None) except PublishingStatus.DoesNotExist: publish = None if check_publish: if not publish or publish.status != 'Public': return active_verb = create_verb if created else update_verb actor = instance action_object = None if provide_user: actor = user() if not actor or actor.is_anonymous(): # a non request caused this return action_object = instance action(actor, verb=active_verb, action_object=action_object)
def handler(sender, instance, created, **kwargs): if created and not create_verb: return try: publish = getattr(instance, 'publish', None) except PublishingStatus.DoesNotExist: publish = None if publish and publish.status != 'Public': return active_verb = create_verb if created else update_verb actor = instance action_object = None if provide_user: actor = user() if not actor: # a non request caused this return action_object = instance if _is_annotations_layer(action_object): # for now, could create an action for the map return action(actor, verb=active_verb, action_object=action_object)
def handler(sender, instance, created, **kwargs): if created and not create_verb: return try: publish = getattr(instance, 'publish', None) except PublishingStatus.DoesNotExist: publish = None if publish and publish.status != 'Public': return active_verb = create_verb if created else update_verb actor = instance action_object = None if provide_user: actor = user() if not actor or actor.is_anonymous(): # a non request caused this return action_object = instance if _is_annotations_layer(action_object): # for now, could create an action for the map return action(actor, verb=active_verb, action_object=action_object)