Replace all uploaded file references in a content string with the
    results of rendering a template found under ``template_path`` with
    the ``FileUpload`` instance and the key=value options found in the
    file reference.

    So if "<<<my-uploaded-file:key=val:key2=val2>>>" is found in the
    content string, it will be replaced with the results of rendering
    the selected template with ``upload`` set to the ``FileUpload``
    instance with slug "my-uploaded-file" and ``options`` set to
    {'key': 'val', 'key2': 'val2'}.

    If the given slug is not found, the reference is replaced with the
    empty string.

    If ``djangoembed`` or ``django-oembed`` is installed, also replaces OEmbed
    URLs with the appropriate embed markup.

def render_uploads(content, template_path="adminfiles/render/"):
    """
    Replace all uploaded file references in a content string with the
    results of rendering a template found under ``template_path`` with
    the ``FileUpload`` instance and the key=value options found in the
    file reference.

    So if "<<<my-uploaded-file:key=val:key2=val2>>>" is found in the
    content string, it will be replaced with the results of rendering
    the selected template with ``upload`` set to the ``FileUpload``
    instance with slug "my-uploaded-file" and ``options`` set to
    {'key': 'val', 'key2': 'val2'}.

    If the given slug is not found, the reference is replaced with the
    empty string.

    If ``djangoembed`` or ``django-oembed`` is installed, also replaces OEmbed
    URLs with the appropriate embed markup.
    
    """
    def _replace(match):
        upload, options = parse_match(match)
        return render_upload(upload, template_path, **options)
    return oembed_replace(substitute_uploads(content, _replace))