aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/gui/models.py
diff options
context:
space:
mode:
authorMichael Elkins <melkins@tislabs.com>2012-01-17 05:02:58 +0000
committerMichael Elkins <melkins@tislabs.com>2012-01-17 05:02:58 +0000
commit6383348fbfd65877ba2957c70d461ee466a86bac (patch)
tree8d0017c362eda19f419e33539655f166680244b0 /rpkid/rpki/gui/models.py
parent4d426fd55bc2ef3b45b498d181a2316732d15f7a (diff)
refactor cacheview app to use common rpki.gui.models
svn path=/branches/tk161/; revision=4165
Diffstat (limited to 'rpkid/rpki/gui/models.py')
-rw-r--r--rpkid/rpki/gui/models.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/rpkid/rpki/gui/models.py b/rpkid/rpki/gui/models.py
index 323d43e6..933fe5ee 100644
--- a/rpkid/rpki/gui/models.py
+++ b/rpkid/rpki/gui/models.py
@@ -54,12 +54,17 @@ class Prefix(models.Model):
def prefixlen(self):
"Returns the prefix length for the prefix in this object."
- return self.as_range().prefixlen()
+ return self.as_resource_range().prefixlen()
def get_prefix_display(self):
- "Returns a string version of the prefix in this object."
+ "Return a string representatation of this IP prefix."
return str(self.as_resource_range())
+ def __unicode__(self):
+ """This method may be overridden by subclasses. The default
+ implementation calls get_prefix_display(). """
+ return self.get_prefix_display()
+
class Meta:
abstract = True
@@ -74,7 +79,7 @@ class PrefixV4(Prefix):
prefix_min = IPv4AddressField(db_index=True, null=False)
prefix_max = IPv4AddressField(db_index=True, null=False)
- class Meta:
+ class Meta(Prefix.Meta):
abstract = True
class PrefixV6(Prefix):
@@ -85,7 +90,7 @@ class PrefixV6(Prefix):
prefix_min = IPv6AddressField(db_index=True, null=False)
prefix_max = IPv6AddressField(db_index=True, null=False)
- class Meta:
+ class Meta(Prefix.Meta):
abstract = True
# vim:sw=4 ts=8 expandtab