

def get_context_data(self, **kwargs):
    ctx = super(PackageDetail, self).get_context_data(**kwargs)
    releases = self.object.releases.all()
    if self.kwargs.get('version'):
        releases = releases.filter(version=self.kwargs['version'])
    else:
        releases = releases.filter(hidden=False)
    ctx.update({
        'releases': releases,
        'restricted': self.restricted,
        'show_hidden': (True if self.kwargs.get('version') else False),
    })
    return ctx

dataset/ETHPy150Open crate-archive/crate-site/crateweb/apps/packages/simple/views.py PackageDetail.get_context_data/original