summaryrefslogtreecommitdiff
path: root/mirrors/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'mirrors/models.py')
-rw-r--r--mirrors/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index 80808e2e..bcde210c 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -58,6 +58,8 @@ class MirrorUrl(models.Model):
protocol = models.ForeignKey(MirrorProtocol, related_name="urls",
editable=False, on_delete=models.PROTECT)
mirror = models.ForeignKey(Mirror, related_name="urls")
+ country = models.CharField(max_length=255, blank=True, null=True,
+ db_index=True)
has_ipv4 = models.BooleanField("IPv4 capable", default=True,
editable=False)
has_ipv6 = models.BooleanField("IPv6 capable", default=False,
@@ -73,6 +75,10 @@ class MirrorUrl(models.Model):
def hostname(self):
return urlparse(self.url).hostname
+ @property
+ def real_country(self):
+ return self.country or self.mirror.country
+
def clean(self):
try:
# Auto-map the protocol field by looking at the URL