summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-01-20 23:12:55 -0600
committerDusty Phillips <buchuki@gmail.com>2009-02-06 17:09:55 -0500
commit7ee38a871a94a317fd463a5dc8d116817276132c (patch)
tree65c73ee29239136a7c6fcbd5f50ab2d00e6d619b /main/models.py
parent23f25e52fc9e112e66801613f5721e7d5dbab0f9 (diff)
Refactor mirror model
Break the original model down into a few different components that should give us a lot more flexibility. Mirror is now the top level entity with one-to-many relationships to both URLs and rsync IP addresses. This should allow the DB model to serve all of our currently unsynced needs. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py38
1 files changed, 31 insertions, 7 deletions
diff --git a/main/models.py b/main/models.py
index bcd8ddb2..7f7f42d3 100644
--- a/main/models.py
+++ b/main/models.py
@@ -51,16 +51,40 @@ class PackageManager(models.Manager):
### General Model Classes ###
#############################
class Mirror(models.Model):
- id = models.AutoField(primary_key=True)
- domain = models.CharField(max_length=255)
+ name = models.CharField(max_length=255)
country = models.CharField(max_length=255)
+ admin_email = models.EmailField(max_length=255, blank=True)
+ notes = models.CharField(max_length=255, blank=True)
+ public = models.BooleanField(default=True)
+ active = models.BooleanField(default=True)
+ isos = models.BooleanField(default=True)
+ def __unicode__(self):
+ return self.name
+
+class MirrorProtocol(models.Model):
+ protocol = models.CharField(max_length=10, unique=True)
+ def __unicode__(self):
+ return self.protocol
+ class Meta:
+ verbose_name = 'Mirror Protocol'
+
+class MirrorUrl(models.Model):
url = models.CharField(max_length=255)
- protocol_list = models.CharField(max_length=255, null=True, blank=True)
- admin_email = models.CharField(max_length=255, null=True, blank=True)
- def __str__(self):
- return self.domain
+ protocol = models.ForeignKey(MirrorProtocol, related_name="urls")
+ mirror = models.ForeignKey(Mirror, related_name="urls")
+ def __unicode__(self):
+ return self.url
+ class Meta:
+ verbose_name = 'Mirror URL'
+
+class MirrorRsync(models.Model):
+ hostname = models.CharField(max_length=255)
+ ip = models.IPAddressField()
+ mirror = models.ForeignKey(Mirror, related_name="rsync_ips")
+ def __unicode__(self):
+ return "%s (%s)" % (self.ip, self.hostname)
class Meta:
- db_table = 'mirrors'
+ verbose_name = 'Mirror Rsync IP'
class Press(models.Model):
id = models.AutoField(primary_key=True)