From 1a7e5d22f1c4e948c624d26b4d8c1ed30189acfe Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 19 Jan 2013 12:06:47 -0600 Subject: Add basic release list and details views Signed-off-by: Dan McGee --- feeds.py | 5 +--- releng/models.py | 3 +++ releng/urls.py | 6 +++++ releng/views.py | 13 ++++++++++- templates/releng/release_detail.html | 24 ++++++++++++++++++++ templates/releng/release_list.html | 44 ++++++++++++++++++++++++++++++++++++ 6 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 templates/releng/release_detail.html create mode 100644 templates/releng/release_list.html diff --git a/feeds.py b/feeds.py index c68d3b0..9721f41 100644 --- a/feeds.py +++ b/feeds.py @@ -175,9 +175,6 @@ class ReleaseFeed(Feed): def item_description(self, item): return item.info_html() - # TODO: individual release pages - item_link = '/download/' - def item_pubdate(self, item): return datetime.combine(item.release_date, time()).replace(tzinfo=utc) @@ -185,7 +182,7 @@ class ReleaseFeed(Feed): # http://diveintomark.org/archives/2004/05/28/howto-atom-id date = item.release_date return 'tag:%s,%s:%s' % (Site.objects.get_current().domain, - date.strftime('%Y-%m-%d'), item.iso_url()) + date.strftime('%Y-%m-%d'), item.get_absolute_url()) def item_enclosure_url(self, item): domain = Site.objects.get_current().domain diff --git a/releng/models.py b/releng/models.py index 9f09137..8bc54de 100644 --- a/releng/models.py +++ b/releng/models.py @@ -127,6 +127,9 @@ class Release(models.Model): def __unicode__(self): return self.version + def get_absolute_url(self): + return reverse('releng-release-detail', args=[self.version]) + def dir_path(self): return "iso/%s/" % self.version diff --git a/releng/urls.py b/releng/urls.py index 8d1b8f2..8413d31 100644 --- a/releng/urls.py +++ b/releng/urls.py @@ -1,5 +1,7 @@ from django.conf.urls import include, patterns +from .views import ReleaseListView, ReleaseDetailView + feedback_patterns = patterns('releng.views', (r'^$', 'test_results_overview', {}, 'releng-test-overview'), (r'^submit/$', 'submit_test_result', {}, 'releng-test-submit'), @@ -11,5 +13,9 @@ feedback_patterns = patterns('releng.views', urlpatterns = patterns('', (r'^feedback/', include(feedback_patterns)), + (r'^releases/$', + ReleaseListView.as_view(), {}, 'releng-release-list'), + (r'^releases/(?P[-.\w]+)/$', + ReleaseDetailView.as_view(), {}, 'releng-release-detail'), ) # vim: set ts=4 sw=4 et: diff --git a/releng/views.py b/releng/views.py index 67b3cb4..6c49275 100644 --- a/releng/views.py +++ b/releng/views.py @@ -3,10 +3,11 @@ from django.conf import settings from django.db.models import Count, Max from django.http import Http404 from django.shortcuts import get_object_or_404, redirect, render +from django.views.generic import DetailView, ListView from .models import (Architecture, BootType, Bootloader, ClockChoice, Filesystem, HardwareType, InstallType, Iso, IsoType, Module, Source, - Test) + Test, Release) def standard_field(model, empty_label=None, help_text=None, required=True): @@ -213,4 +214,14 @@ def iso_overview(request): } return render(request, 'releng/iso_overview.html', context) + +class ReleaseListView(ListView): + model = Release + + +class ReleaseDetailView(DetailView): + model = Release + slug_field = 'version' + slug_url_kwarg = 'version' + # vim: set ts=4 sw=4 et: diff --git a/templates/releng/release_detail.html b/templates/releng/release_detail.html new file mode 100644 index 0000000..fec9ce2 --- /dev/null +++ b/templates/releng/release_detail.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} +{% block title %}Arch Linux - Release: {{ release.version }}{% endblock %} + +{% block content %} +
+

{{ release.version }}

+ +
    +
  • Release Date: {{ release.release_date|date }}
  • + {% if release.kernel_version %}
  • Kernel Version: {{ release.kernel_version }}
  • {% endif %} +
  • Available: {{ release.available|yesno }}
  • + {% if release.available %}
  • Torrent
  • {% endif %} + {% if release.available %}
  • Magnet
  • {% endif %} +
  • Download Size: {% if release.file_size %}{{ release.file_size|filesizeformat }}{% else %}Unknown{% endif %}
  • +
+ + {% if release.info %} +

Release Notes

+ +
{{ release.info_html }}
+ {% endif %} +
+{% endblock %} diff --git a/templates/releng/release_list.html b/templates/releng/release_list.html new file mode 100644 index 0000000..1657249 --- /dev/null +++ b/templates/releng/release_list.html @@ -0,0 +1,44 @@ +{% extends "base.html" %} +{% load url from future %} + +{% block title %}Arch Linux - Releases{% endblock %} + +{% block head %} + +{% endblock %} + +{% block content %} +
+ +

Releases

+ + + + + + + + + + + + + + + {% for item in release_list %} + + + + + + + + + + {% endfor %} + +
Release DateVersionKernel VersionAvailable?TorrentMagnetDownload Size
{{ item.release_date|date }}{{ item.version }}{{ item.kernel_version|default:"" }}{{ item.available|yesno }}{% if item.available %}Torrent{% endif %}{% if item.available %}Magnet{% endif %}{% if item.file_size %}{{ item.file_size|filesizeformat }}{% endif %}
+ +
+{% endblock %} -- cgit v1.2.3-24-g4f1b