summaryrefslogtreecommitdiffstats
path: root/mirrors/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-25 00:09:46 -0500
committerDan McGee <dan@archlinux.org>2012-04-25 00:09:46 -0500
commit20675141c340ea3d2d6d8305f8ba0950d3bf974c (patch)
tree97366ef62607f0caadd45481613d0db6fdb5e853 /mirrors/models.py
parent116751e4bab183b3cca93ab13f7f4f21c752be4e (diff)
downloadarchweb-20675141c340ea3d2d6d8305f8ba0950d3bf974c.tar.gz
archweb-20675141c340ea3d2d6d8305f8ba0950d3bf974c.zip
Add django_countries country code fields and population migrations
This adds these columns and attempts to populate them with data from our existing country column data. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/models.py')
-rw-r--r--mirrors/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index 46753fac..79968412 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -3,6 +3,7 @@ from urlparse import urlparse
from django.db import models
from django.core.exceptions import ValidationError
+from django_countries import CountryField
class NullCharField(models.CharField):
description = "String (up to %(max_length)s), NULL if value is empty"
@@ -25,6 +26,7 @@ class Mirror(models.Model):
tier = models.SmallIntegerField(default=2, choices=TIER_CHOICES)
upstream = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
country_old = models.CharField(max_length=255, db_index=True)
+ country = CountryField(blank=True)
admin_email = models.EmailField(max_length=255, blank=True)
public = models.BooleanField(default=True)
active = models.BooleanField(default=True)
@@ -34,7 +36,7 @@ class Mirror(models.Model):
notes = models.TextField(blank=True)
class Meta:
- ordering = ('country_old', 'name')
+ ordering = ('country', 'name')
def __unicode__(self):
return self.name
@@ -70,6 +72,7 @@ class MirrorUrl(models.Model):
mirror = models.ForeignKey(Mirror, related_name="urls")
country_old = NullCharField(max_length=255, null=True, blank=True,
db_index=True)
+ country = CountryField(blank=True)
has_ipv4 = models.BooleanField("IPv4 capable", default=True,
editable=False)
has_ipv6 = models.BooleanField("IPv6 capable", default=False,