diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-10-02 20:52:06 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-10-02 20:52:06 -0400 |
commit | dceadbebbe0b196278573ed294be8c631d45ecef (patch) | |
tree | 5274fc4e0397a705dcf1d488074bea9503b3f2c7 /mirrors/models.py | |
parent | 724f8c309c97aa9af7f963687342e8f37e682204 (diff) | |
parent | 355087ebe2e3fbd5f860e4655888a89d9df52e34 (diff) |
Merge branch 'master-nomake'
Diffstat (limited to 'mirrors/models.py')
-rw-r--r-- | mirrors/models.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/mirrors/models.py b/mirrors/models.py index 0b053043..641a6b97 100644 --- a/mirrors/models.py +++ b/mirrors/models.py @@ -32,6 +32,7 @@ class Mirror(models.Model): bug = models.PositiveIntegerField("Flyspray bug", null=True, blank=True) notes = models.TextField(blank=True) created = models.DateTimeField(editable=False) + last_modified = models.DateTimeField(editable=False) class Meta: ordering = ('name',) @@ -74,6 +75,12 @@ class MirrorUrl(models.Model): created = models.DateTimeField(editable=False) active = models.BooleanField(default=True) + class Meta: + verbose_name = 'mirror URL' + + def __unicode__(self): + return self.url + def address_families(self): hostname = urlparse(self.url).hostname info = socket.getaddrinfo(hostname, None, 0, socket.SOCK_STREAM) @@ -100,11 +107,8 @@ class MirrorUrl(models.Model): self.has_ipv4 = False self.has_ipv6 = False - def __unicode__(self): - return self.url - - class Meta: - verbose_name = 'mirror URL' + def get_absolute_url(self): + return '/mirrors/%s/%d/' % (self.mirror.name, self.pk) class MirrorRsync(models.Model): @@ -114,7 +118,7 @@ class MirrorRsync(models.Model): created = models.DateTimeField(editable=False) def __unicode__(self): - return self.ip + return unicode(self.ip) class Meta: verbose_name = 'mirror rsync IP' @@ -123,7 +127,7 @@ class MirrorRsync(models.Model): class CheckLocation(models.Model): hostname = models.CharField(max_length=255) - source_ip = models.GenericIPAddressField(verbose_name='source IP', + source_ip = models.GenericIPAddressField('source IP', unpack_ipv4=True, unique=True) country = CountryField() created = models.DateTimeField(editable=False) |