diff options
author | Dan McGee <dan@archlinux.org> | 2012-11-20 19:16:25 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-11-20 19:16:25 -0600 |
commit | f7331a0eca351300685ebee494e810d8c82c35b1 (patch) | |
tree | 51be653b718cda48187f28f63218d3b3fb44cd26 | |
parent | 160a08bba5324b25abd9e866b884c91d75e597b0 (diff) |
Add Release model to releng
This should prevent the need for monthly template updates from Pierre
and Thomas; best to just let them enter the data themselves and have it
show up on the website.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | public/views.py | 6 | ||||
-rw-r--r-- | releng/admin.py | 23 | ||||
-rw-r--r-- | releng/migrations/0004_auto__add_release.py | 121 | ||||
-rw-r--r-- | releng/models.py | 19 | ||||
-rw-r--r-- | templates/public/download.html | 22 |
5 files changed, 167 insertions, 24 deletions
diff --git a/public/views.py b/public/views.py index 3e15f9df..fefe032e 100644 --- a/public/views.py +++ b/public/views.py @@ -13,6 +13,7 @@ from devel.models import MasterKey, PGPSignature from main.models import Arch, Repo, Donor from mirrors.models import MirrorUrl from news.models import News +from releng.models import Release from .utils import get_recent_updates @@ -77,12 +78,17 @@ def donate(request): @cache_control(max_age=300) def download(request): + try: + release = Release.objects.filter(available=True).latest() + except Release.DoesNotExist: + release = None mirror_urls = MirrorUrl.objects.select_related('mirror').filter( protocol__default=True, mirror__public=True, mirror__active=True, mirror__isos=True) sort_by = attrgetter('real_country.name', 'mirror.name') mirror_urls = sorted(mirror_urls, key=sort_by) context = { + 'release': release, 'releng_iso_url': settings.ISO_LIST_URL, 'releng_pxeboot_url': settings.PXEBOOT_URL, 'mirror_urls': mirror_urls, diff --git a/releng/admin.py b/releng/admin.py index 42755002..c7e6396e 100644 --- a/releng/admin.py +++ b/releng/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin from .models import (Architecture, BootType, Bootloader, ClockChoice, Filesystem, HardwareType, InstallType, Iso, IsoType, Module, Source, - Test) + Test, Release) class IsoAdmin(admin.ModelAdmin): list_display = ('name', 'created', 'active', 'removed') @@ -14,19 +14,20 @@ class TestAdmin(admin.ModelAdmin): 'iso', 'success') list_filter = ('success', 'iso') +class ReleaseAdmin(admin.ModelAdmin): + list_display = ('version', 'release_date', 'kernel_version', 'available', + 'created') + list_filter = ('available', 'release_date') -admin.site.register(Architecture) -admin.site.register(BootType) -admin.site.register(Bootloader) -admin.site.register(ClockChoice) -admin.site.register(Filesystem) -admin.site.register(HardwareType) -admin.site.register(InstallType) -admin.site.register(IsoType) -admin.site.register(Module) -admin.site.register(Source) + +SIMPLE_MODELS = (Architecture, BootType, Bootloader, ClockChoice, Filesystem, + HardwareType, InstallType, IsoType, Module, Source) + +for model in SIMPLE_MODELS: + admin.site.register(model) admin.site.register(Iso, IsoAdmin) admin.site.register(Test, TestAdmin) +admin.site.register(Release, ReleaseAdmin) # vim: set ts=4 sw=4 et: diff --git a/releng/migrations/0004_auto__add_release.py b/releng/migrations/0004_auto__add_release.py new file mode 100644 index 00000000..fe4acea5 --- /dev/null +++ b/releng/migrations/0004_auto__add_release.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + db.create_table('releng_release', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('release_date', self.gf('django.db.models.fields.DateField')(db_index=True)), + ('version', self.gf('django.db.models.fields.CharField')(max_length=50)), + ('kernel_version', self.gf('django.db.models.fields.CharField')(max_length=50, blank=True)), + ('torrent_infohash', self.gf('django.db.models.fields.CharField')(max_length=64, blank=True)), + ('created', self.gf('django.db.models.fields.DateTimeField')()), + ('available', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('info', self.gf('django.db.models.fields.TextField')(blank=True)), + )) + db.send_create_signal('releng', ['Release']) + + def backwards(self, orm): + db.delete_table('releng_release') + + + models = { + 'releng.architecture': { + 'Meta': {'object_name': 'Architecture'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.bootloader': { + 'Meta': {'object_name': 'Bootloader'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.boottype': { + 'Meta': {'object_name': 'BootType'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.clockchoice': { + 'Meta': {'object_name': 'ClockChoice'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.filesystem': { + 'Meta': {'object_name': 'Filesystem'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.hardwaretype': { + 'Meta': {'object_name': 'HardwareType'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.installtype': { + 'Meta': {'object_name': 'InstallType'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.iso': { + 'Meta': {'object_name': 'Iso'}, + 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'created': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'removed': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}) + }, + 'releng.isotype': { + 'Meta': {'object_name': 'IsoType'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.module': { + 'Meta': {'object_name': 'Module'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.release': { + 'Meta': {'ordering': "('-release_date', '-version')", 'object_name': 'Release'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'created': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'info': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'kernel_version': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}), + 'release_date': ('django.db.models.fields.DateField', [], {'db_index': 'True'}), + 'torrent_infohash': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}), + 'version': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'releng.source': { + 'Meta': {'object_name': 'Source'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'releng.test': { + 'Meta': {'object_name': 'Test'}, + 'architecture': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.Architecture']"}), + 'boot_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.BootType']"}), + 'bootloader': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.Bootloader']"}), + 'clock_choice': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.ClockChoice']"}), + 'comments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'created': ('django.db.models.fields.DateTimeField', [], {}), + 'filesystem': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.Filesystem']"}), + 'hardware_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.HardwareType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'install_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.InstallType']"}), + 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), + 'iso': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.Iso']"}), + 'iso_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.IsoType']"}), + 'modules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['releng.Module']", 'null': 'True', 'blank': 'True'}), + 'rollback_filesystem': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'rollback_test_set'", 'null': 'True', 'to': "orm['releng.Filesystem']"}), + 'rollback_modules': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'rollback_test_set'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['releng.Module']"}), + 'source': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['releng.Source']"}), + 'success': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), + 'user_name': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['releng'] diff --git a/releng/models.py b/releng/models.py index bd178add..2f9a0785 100644 --- a/releng/models.py +++ b/releng/models.py @@ -105,7 +105,24 @@ class Test(models.Model): comments = models.TextField(null=True, blank=True) -for model in (Iso, Test): +class Release(models.Model): + release_date = models.DateField(db_index=True) + version = models.CharField(max_length=50) + kernel_version = models.CharField(max_length=50, blank=True) + torrent_infohash = models.CharField(max_length=64, blank=True) + created = models.DateTimeField(editable=False) + available = models.BooleanField(default=True) + info = models.TextField('Public information', blank=True) + + class Meta: + get_latest_by = 'release_date' + ordering = ('-release_date', '-version') + + def __unicode__(self): + return self.version + + +for model in (Iso, Test, Release): pre_save.connect(set_created_field, sender=model, dispatch_uid="releng.models") diff --git a/templates/public/download.html b/templates/public/download.html index 2fddd4e9..d0754e5b 100644 --- a/templates/public/download.html +++ b/templates/public/download.html @@ -7,7 +7,6 @@ {% block navbarclass %}anb-download{% endblock %} {% block content %} -{% with version="2012.11.01" kernel_version="3.6.4" torrent_infohash="f86f84c74edc90336f94f0837afa3071ada2aaa8" %} <div id="arch-downloads" class="box"> <h2>Arch Linux Downloads</h2> @@ -20,8 +19,8 @@ can always be updated with `pacman -Syu`.</p> <ul> - <li><strong>Current Release:</strong> {{ version }}</li> - <li><strong>Included Kernel:</strong> {{ kernel_version }}</li> + <li><strong>Current Release:</strong> {{ release.version }}</li> + <li><strong>Included Kernel:</strong> {{ release.kernel_version }}</li> <li><a href="https://wiki.archlinux.org/index.php/Installation_Guide">Installation Guide</a></li> <li><strong>Resources:</strong> <ul> @@ -45,9 +44,9 @@ download is finished, so you can seed it back to others. <em>A web-seed capable client is recommended for fastest download speeds.</em></p> <ul> - <li><a href="https://www.archlinux.org/iso/{{version}}/archlinux-{{version}}-dual.iso.torrent" - title="Download for both architectures">Download archlinux-{{version}}-dual.iso.torrent</a> - (<a href="magnet:?xt=urn:btih:{{torrent_infohash}}&dn=archlinux-{{version}}-dual.iso&tr=udp://tracker.archlinux.org:6969&tr=http://tracker.archlinux.org:6969/announce">Magnet</a>)</li> + <li><a href="https://www.archlinux.org/iso/{{ release.version }}/archlinux-{{ release.version }}-dual.iso.torrent" + title="Download for both architectures">Download archlinux-{{ release.version }}-dual.iso.torrent</a> + (<a href="magnet:?{% if release.torrent_infohash %}xt=urn:btih:{{ release.torrent_infohash }}&{% endif %}dn=archlinux-{{ release.version }}-dual.iso&tr=udp://tracker.archlinux.org:6969&tr=http://tracker.archlinux.org:6969/announce">Magnet</a>)</li> </ul> <h3>Netboot</h3> @@ -70,11 +69,11 @@ <p>File integrity checksums for the latest releases can be found below:</p> <ul> - <li><a href="https://www.archlinux.org/iso/{{version}}/archlinux-{{version}}-dual.iso.sig" + <li><a href="https://www.archlinux.org/iso/{{ release.version }}/archlinux-{{ release.version }}-dual.iso.sig" title="Get the latest PGP signature">PGP signature</a></li> - <li><a href="https://www.archlinux.org/iso/{{version}}/sha1sums.txt" + <li><a href="https://www.archlinux.org/iso/{{ release.version }}/sha1sums.txt" title="Get the latest SHA1 checksums">SHA1 checksums</a></li> - <li><a href="https://www.archlinux.org/iso/{{version}}/md5sums.txt" + <li><a href="https://www.archlinux.org/iso/{{ release.version }}/md5sums.txt" title="Get the latest MD5 checksums">MD5 checksums</a></li> </ul> @@ -86,8 +85,8 @@ {% else %}<h5>Worldwide</h5>{% endif %} <ul> {% for mirror_url in country.list %} - <li><a href="{{ mirror_url.url }}iso/{{ version }}/" - title="Download from {{ mirror_url.url }}iso/{{ version }}/">{{ mirror_url.mirror.name }}</a></li> + <li><a href="{{ mirror_url.url }}iso/{{ release.version }}/" + title="Download from {{ mirror_url.url }}iso/{{ release.version }}/">{{ mirror_url.mirror.name }}</a></li> {% endfor %} </ul> {% endfor %} @@ -98,5 +97,4 @@ instructions listed <a href="https://wiki.archlinux.org/index.php/DeveloperWiki:NewMirrors">here</a>.</p> </div> -{% endwith %} {% endblock %} |