from django.shortcuts import render from label.models import Artist, Release from label.tools import ( get_catalog_tag_from_id, get_contribs, ) def releases_view(request): Artist.objects.all() releases = Release.objects.filter(released=True) releases_and_infos = [] for release in releases: release_tag = get_catalog_tag_from_id(release.ident) releases_and_infos.append({ 'id': release.id, 'release_type': release.release_type, 'tag': release_tag, 'title': release.title, 'contribs': get_contribs(release.contributors.all()), 'year': release.year, 'cover': release.cover, 'url_bandcamp': release.url_bandcamp, }) context = {'releases': releases_and_infos} return render(request, 'label/releases.html', context)