@require_extended
    def create(self, request, source):
        if False:
            return rc.DUPLICATE_ENTRY
        else:
            source = Source.objects.get(slug=source)
            action = Action.objects.get(source=source, slug=request.data['action'])

            if request.data.get('direct_object_content_type_id', None) and request.data.get('direct_object_object_id', None):
                direct_object, created = ActivityObject.objects.get_or_create(
                    source = source,
                    content_type_id = request.data['direct_object_content_type_id'],
                    object_id = request.data['direct_object_object_id'],
                )
            else:
                direct_object = None

            if request.data.get('indirect_object_content_type_id', None) and request.data.get('indirect_object_object_id', None):
                indirect_object, created = ActivityObject.objects.get_or_create(
                    source = source,
                    content_type_id = request.data['indirect_object_content_type_id'],
                    object_id = request.data['indirect_object_object_id'],
                )
            else:
                indirect_object = None

            user = None
            user_id = request.data.get('user_id', '')
            if user_id:
                user, is_new = UserObject.objects.get_or_create(user_id=user_id)

            activity = Activity(
                action=action,
                user=user,
                direct_object=direct_object,
                indirect_object=indirect_object,
                timestamp=request.data.get('timestamp', datetime.datetime.now()),
                context=request.data.get('context', None),
            )
            activity.save()

            return activity
Creates a new Activity record.
dataset/ETHPy150Open nowells/django-activitystreams/activitystreams/handlers.py/SourceActivityHandler.create