'Attach all the files to the versions.'

@classmethod
def transformer(cls, versions):

    ids = set((v.id for v in versions))
    if (not versions):
        return
    def rollup(xs):
        groups = sorted_groupby(xs, 'version_id')
        return dict(((k, list(vs)) for (k, vs) in groups))
    file_dict = rollup(File.objects.filter(version__in=ids))
    for version in versions:
        v_id = version.id
        version.all_files = file_dict.get(v_id, [])
        for f in version.all_files:
            f.version = version
