

@register.assignment_tag
def new_packages(num):
    return [x for x in ChangeLog.objects.filter(type=ChangeLog.TYPES.new).select_related('package', 'release').prefetch_related('package__releases').order_by('-created')[:(num * 3)] if len(x.package.releases.all())][:num]

dataset/ETHPy150Open crateio/crate.web/crate/web/packages/templatetags/package_tags.py new_packages/original