From 579f4c4b57a942f0f67ea8364c6d7fc349de687b Mon Sep 17 00:00:00 2001 From: Dece Date: Thu, 17 Aug 2017 19:36:54 +0200 Subject: [PATCH] Minor tweaks --- label/models.py | 6 +++--- label/templates/label/artists.html | 2 +- label/views.py | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/label/models.py b/label/models.py index 7f3bddd..a0a45ee 100644 --- a/label/models.py +++ b/label/models.py @@ -50,7 +50,7 @@ class Release(models.Model): TYPE_HINT = 'full-length (0), EP (1), Split (2), Démo (3)' EMBED_HINT = 'HTML iframe -- for Bandcamp, add the whole tracklist' - ident = models.IntegerField() + ident = models.IntegerField(unique=True) title = models.CharField(max_length=256) contributors = models.ManyToManyField(Artist) release_type = models.IntegerField(default=0, help_text=TYPE_HINT) @@ -63,7 +63,7 @@ class Release(models.Model): return self.title class Meta(object): - ordering = ('ident', 'title') + ordering = ('-ident',) class VideoClip(models.Model): @@ -78,4 +78,4 @@ class VideoClip(models.Model): return self.title class Meta(object): - ordering = ('year', 'title') + ordering = ('-year', 'title') diff --git a/label/templates/label/artists.html b/label/templates/label/artists.html index 1ae2b2b..43a2992 100644 --- a/label/templates/label/artists.html +++ b/label/templates/label/artists.html @@ -10,7 +10,7 @@ {% block content %}

Core

-

Main project roster of Idre

+

Main projects roster of Idre

{% for artist in artists %} diff --git a/label/views.py b/label/views.py index e682e89..7036037 100644 --- a/label/views.py +++ b/label/views.py @@ -21,7 +21,7 @@ def artist_view(request, slug): releases = artist.release_set.all() for release in releases: - release.tag = tools.get_catalog_tag_from_id(release.ident) + release.tag = get_catalog_tag_from_id(release.ident) context = { 'artist': artist, 'releases': releases } return render(request, 'label/artist.html', context) @@ -33,13 +33,13 @@ def releases_view(request): releases_and_infos = [] for release in releases: - release_tag = tools.get_catalog_tag_from_id(release.ident) + 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': tools.get_contribs(release.contributors.all()), + 'contribs': get_contribs(release.contributors.all()), 'year': release.year, 'cover': release.cover, }) @@ -49,14 +49,14 @@ def releases_view(request): def release_view(request, tag): - ident = tools.get_id_from_catalog_tag(tag) + ident = get_id_from_catalog_tag(tag) release = get_object_or_404(Release, ident = ident) - contribs = tools.get_contribs(release.contributors.all()) + contribs = get_contribs(release.contributors.all()) context = { 'release': release, 'contribs': contribs } return render(request, 'label/release.html', context) def videos_view(request): - videos = VideoClip.objects.all() + videos = VideoClip.objects.order_by('-year', 'title') context = { 'videos': videos } return render(request, 'label/videos.html', context)