summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-11-01 12:31:52 -0500
committerDan McGee <dan@archlinux.org>2014-11-01 12:31:52 -0500
commite609552c59d05a41b98e786047d1ff02c1e3ab10 (patch)
treee91cf9c7abbb4db48272584681b091ba200c8d7e
parente7449f7063f3f56af118ed8ad703ec3fce6bc39a (diff)
Add bandwidth field to mirror URLs
Not using this anywhere just yet, but suggested by Florian so we can do some more fancy things down the road, like determine bandwidth by country. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/admin.py2
-rw-r--r--mirrors/migrations/0002_mirrorurl_bandwidth.py20
-rw-r--r--mirrors/models.py3
3 files changed, 23 insertions, 2 deletions
diff --git a/mirrors/admin.py b/mirrors/admin.py
index d5c89c2a..16a97ea2 100644
--- a/mirrors/admin.py
+++ b/mirrors/admin.py
@@ -11,7 +11,7 @@ from .models import (Mirror, MirrorProtocol, MirrorUrl, MirrorRsync,
class MirrorUrlForm(forms.ModelForm):
class Meta:
model = MirrorUrl
- fields = ('url', 'country', 'active')
+ fields = ('url', 'country', 'bandwidth', 'active')
def clean_url(self):
# is this a valid-looking URL?
diff --git a/mirrors/migrations/0002_mirrorurl_bandwidth.py b/mirrors/migrations/0002_mirrorurl_bandwidth.py
new file mode 100644
index 00000000..f0118199
--- /dev/null
+++ b/mirrors/migrations/0002_mirrorurl_bandwidth.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('mirrors', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='mirrorurl',
+ name='bandwidth',
+ field=models.FloatField(null=True, verbose_name=b'bandwidth (mbits)', blank=True),
+ preserve_default=True,
+ ),
+ ]
diff --git a/mirrors/models.py b/mirrors/models.py
index 641a6b97..820f3328 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -72,8 +72,9 @@ class MirrorUrl(models.Model):
editable=False)
has_ipv6 = models.BooleanField("IPv6 capable", default=False,
editable=False)
- created = models.DateTimeField(editable=False)
active = models.BooleanField(default=True)
+ bandwidth = models.FloatField("bandwidth (mbits)", null=True, blank=True)
+ created = models.DateTimeField(editable=False)
class Meta:
verbose_name = 'mirror URL'