This commit is contained in:
Sebastian Lohff 2017-03-21 19:34:02 +01:00
parent 189ae23b4a
commit adc034f8f0
3 changed files with 15 additions and 4 deletions

View File

@ -74,3 +74,9 @@ class ReverseZone(models.Model):
def getNoDeleteReasons(self): def getNoDeleteReasons(self):
return [] return []
def canEdit(self, user):
if self.parentNet:
return self.parentNet.canEdit(user)
else:
return False

View File

@ -79,7 +79,8 @@ class NameserverDetail(LoginRequiredMixin, DetailView):
model = Nameserver model = Nameserver
slug_field = "name" slug_field = "name"
slug_url_kwarg = "domain" slug_url_kwarg = "domain"
context_object_name = "nameserver" #context_object_name = "nameserver"
template_name = "domains/handle_show.html"
class NameserverEdit(MntGenericMixin, LoginRequiredMixin, UpdateView): class NameserverEdit(MntGenericMixin, LoginRequiredMixin, UpdateView):
@ -119,6 +120,7 @@ class ReverseZoneDetail(LoginRequiredMixin, DetailView):
slug_field = "name" slug_field = "name"
slug_url_kwarg = "domain" slug_url_kwarg = "domain"
context_object_name = "nameserver" context_object_name = "nameserver"
template_name = "domains/handle_show.html"
class ReverseZoneEdit(MntGenericMixin, LoginRequiredMixin, UpdateView): class ReverseZoneEdit(MntGenericMixin, LoginRequiredMixin, UpdateView):

View File

@ -9,7 +9,7 @@ def _addFields(fields, obj, fieldNames):
def getWhoisObjectFields(obj, owner): def getWhoisObjectFields(obj, owner):
fields = [] fields = []
if getattr(obj, "handle"): if hasattr(obj, "handle"):
_addFields(fields, obj, ["handle"]) _addFields(fields, obj, ["handle"])
c = type(obj) c = type(obj)
@ -22,9 +22,9 @@ def getWhoisObjectFields(obj, owner):
elif c == whoisdb.models.ASBlock: elif c == whoisdb.models.ASBlock:
_addFields(fields, obj, ["name"]) _addFields(fields, obj, ["name"])
fields.append(("AS Range", "%s - %s" % (obj.asBegin, obj.asEnd))) fields.append(("AS Range", "%s - %s" % (obj.asBegin, obj.asEnd)))
_addFields(fields, obj, ["description", "mnt_by", "mnt_lower", "admin_c"]) _addFields(fields, obj, ["description", "parent_block", "mnt_by", "mnt_lower", "admin_c"])
elif c == whoisdb.models.ASNumber: elif c == whoisdb.models.ASNumber:
_addFields(fields, obj, ["name", "number", "description", "mnt_by", "mnt_lower", "admin_c"]) _addFields(fields, obj, ["name", "number", "description", "volatile", "mnt_by", "mnt_lower", "admin_c"])
elif c == whoisdb.models.InetNum: elif c == whoisdb.models.InetNum:
_addFields(fields, obj, ["name"]) _addFields(fields, obj, ["name"])
fields.append(("Address CIDR", obj.prefix())) fields.append(("Address CIDR", obj.prefix()))
@ -40,3 +40,6 @@ def getWhoisObjectFields(obj, owner):
return fields return fields
def guessWhoisObject(self, handle):
# is it a normal handle?
pass