diff options
author | Dan McGee <dan@archlinux.org> | 2013-01-19 17:55:58 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-01-19 17:59:18 +0100 |
commit | 8cfaa39a0464f7ee35af76473d3e73ae587a6cb8 (patch) | |
tree | f703bf38c84d2c53ec3452484b1d59668cfb3007 | |
parent | 23ef118ac129e17d251634d2ef3c88c6d74279e3 (diff) | |
download | archweb-8cfaa39a0464f7ee35af76473d3e73ae587a6cb8.tar.gz archweb-8cfaa39a0464f7ee35af76473d3e73ae587a6cb8.tar.xz |
Add more metadata to releng Release model
Add a file_size field which we will use in the RSS feed, and also add a
field for future storage of the torrent data itself.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | feeds.py | 4 | ||||
-rw-r--r-- | releng/migrations/0005_auto__add_field_release_file_size__add_field_release_torrent_data.py | 127 | ||||
-rw-r--r-- | releng/models.py | 3 | ||||
-rw-r--r-- | templates/public/download.html | 4 |
4 files changed, 136 insertions, 2 deletions
@@ -192,7 +192,9 @@ class ReleaseFeed(Feed): proto = 'https' return "%s://%s/%s.torrent" % (proto, domain, item.iso_url()) + def item_enclosure_length(self, item): + return item.file_size or "" + item_enclosure_mime_type = 'application/x-bittorrent' - item_enclosure_length = 0 # vim: set ts=4 sw=4 et: diff --git a/releng/migrations/0005_auto__add_field_release_file_size__add_field_release_torrent_data.py b/releng/migrations/0005_auto__add_field_release_file_size__add_field_release_torrent_data.py new file mode 100644 index 0000000..96e0727 --- /dev/null +++ b/releng/migrations/0005_auto__add_field_release_file_size__add_field_release_torrent_data.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Release.file_size' + db.add_column('releng_release', 'file_size', + self.gf('main.fields.PositiveBigIntegerField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Release.torrent_data' + db.add_column('releng_release', 'torrent_data', + self.gf('django.db.models.fields.TextField')(default='', blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Release.file_size' + db.delete_column('releng_release', 'file_size') + + # Deleting field 'Release.torrent_data' + db.delete_column('releng_release', 'torrent_data') + + + 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', [], {}), + 'file_size': ('main.fields.PositiveBigIntegerField', [], {'null': 'True', 'blank': 'True'}), + '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_data': ('django.db.models.fields.TextField', [], {'blank': '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']
\ No newline at end of file diff --git a/releng/models.py b/releng/models.py index a22e01d..9f09137 100644 --- a/releng/models.py +++ b/releng/models.py @@ -5,6 +5,7 @@ from django.db import models from django.db.models.signals import pre_save from django.utils.safestring import mark_safe +from main.fields import PositiveBigIntegerField from main.utils import set_created_field @@ -113,9 +114,11 @@ class Release(models.Model): version = models.CharField(max_length=50) kernel_version = models.CharField(max_length=50, blank=True) torrent_infohash = models.CharField(max_length=64, blank=True) + file_size = PositiveBigIntegerField(null=True, blank=True) created = models.DateTimeField(editable=False) available = models.BooleanField(default=True) info = models.TextField('Public information', blank=True) + torrent_data = models.TextField(blank=True) class Meta: get_latest_by = 'release_date' diff --git a/templates/public/download.html b/templates/public/download.html index 8ddbc23..2949084 100644 --- a/templates/public/download.html +++ b/templates/public/download.html @@ -58,7 +58,9 @@ <em>A web-seed capable client is recommended for fastest download speeds.</em></p> <p><a href="https://www.archlinux.org/{{ release.iso_url }}.torrent" title="Download for both architectures">Download torrent for {{ release.version }}</a> - (<a href="{{ release.magnet_uri }}">Magnet</a>)</p> + (<a href="{{ release.magnet_uri }}">Magnet</a>) + {% if release.file_size %}({{ release.file_size|filesizeformat }}){% endif %} + </p> <h3>Netboot</h3> |