diff options
-rw-r--r-- | feeds.py | 5 | ||||
-rw-r--r-- | releng/models.py | 3 | ||||
-rw-r--r-- | releng/urls.py | 6 | ||||
-rw-r--r-- | releng/views.py | 13 | ||||
-rw-r--r-- | templates/releng/release_detail.html | 24 | ||||
-rw-r--r-- | templates/releng/release_list.html | 44 |
6 files changed, 90 insertions, 5 deletions
@@ -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 9f091371..8bc54def 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 8d1b8f24..8413d318 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<version>[-.\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 67b3cb4a..6c49275f 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 00000000..fec9ce2b --- /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 %} +<div class="release box"> + <h2>{{ release.version }}</h2> + + <ul> + <li><strong>Release Date:</strong> {{ release.release_date|date }}</li> + {% if release.kernel_version %}<li><strong>Kernel Version:</strong> {{ release.kernel_version }}</li>{% endif %} + <li><strong>Available:</strong> {{ release.available|yesno }}</li> + {% if release.available %}<li><a href="https://www.archlinux.org/{{ release.iso_url }}.torrent" + title="Download torrent for {{ release.version }}">Torrent</a></li>{% endif %} + {% if release.available %}<li><a href="{{ release.magnet_uri }}">Magnet</a></li>{% endif %} + <li><strong>Download Size:</strong> {% if release.file_size %}{{ release.file_size|filesizeformat }}{% else %}Unknown{% endif %}</li> + </ul> + + {% if release.info %} + <h3>Release Notes</h3> + + <div class="article-content">{{ release.info_html }}</div> + {% endif %} +</div> +{% endblock %} diff --git a/templates/releng/release_list.html b/templates/releng/release_list.html new file mode 100644 index 00000000..1657249f --- /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 %} +<link rel="alternate" type="application/rss+xml" title="Arch Linux News Updates" href="/feeds/releases/" /> +{% endblock %} + +{% block content %} +<div id="release-list" class="box"> + + <h2>Releases</h2> + + <table id="release-table" class="results"> + <thead> + <tr> + <th>Release Date</th> + <th>Version</th> + <th>Kernel Version</th> + <th>Available?</th> + <th>Torrent</th> + <th>Magnet</th> + <th>Download Size</th> + </tr> + </thead> + <tbody> + {% for item in release_list %} + <tr class="{% cycle 'odd' 'even' %}"> + <td>{{ item.release_date|date }}</td> + <td><a href="{{ item.get_absolute_url }}" title="Release details for {{ item.version }}">{{ item.version }}</a></td> + <td>{{ item.kernel_version|default:"" }}</td> + <td>{{ item.available|yesno }}</td> + <td>{% if item.available %}<a href="https://www.archlinux.org/{{ item.iso_url }}.torrent" + title="Download torrent for {{ item.version }}">Torrent</a>{% endif %}</td> + <td>{% if item.available %}<a href="{{ item.magnet_uri }}">Magnet</a>{% endif %}</td> + <td>{% if item.file_size %}{{ item.file_size|filesizeformat }}{% endif %}</td> + </tr> + {% endfor %} + </tbody> + </table> + +</div> +{% endblock %} |