def upload_to_dict(upload):
    """Creates a Python dict for an Upload database entity.

    This is an admin-only function that exposes more database information than
    the method on Upload.
    """
    return dict(
        id=upload.id,
        flake=upload.flake,
        filename=upload.filename,
        mimetype=upload.mimetype,
        uri=upload.uri,
        uploader=upload.user.to_dict(),
        post=upload.post.to_dict()
    )