Fixed domain detal viewing in search

This commit is contained in:
Sebastian Lohff 2017-03-31 03:26:10 +02:00
parent 123503b8dd
commit 6878cfebde
3 changed files with 14 additions and 2 deletions

View File

@ -30,6 +30,9 @@ class Nameserver(MntdObject):
def __str__(self): def __str__(self):
return self.name return self.name
def getAppName(self):
return "domains"
def getNoDeleteReasons(self): def getNoDeleteReasons(self):
# nameservers can always be deleted # nameservers can always be deleted
return [] return []
@ -52,6 +55,9 @@ class Domain(MntdObject):
def __str__(self): def __str__(self):
return self.name return self.name
def getAppName(self):
return "domains"
def getNoDeleteReasons(self): def getNoDeleteReasons(self):
reasons = [] reasons = []
@ -85,6 +91,9 @@ class ReverseZone(WhoisObject):
def get_absolute_url(self): def get_absolute_url(self):
return reverse("domains:reversezone-show", args=(self.pk,)) return reverse("domains:reversezone-show", args=(self.pk,))
def getAppName(self):
return "domains"
def __str__(self): def __str__(self):
return "%s @ %s" % (self.prefix(), self.parentNet) return "%s @ %s" % (self.prefix(), self.parentNet)

View File

@ -9,8 +9,8 @@
{% if object|userCanEdit:user %} {% if object|userCanEdit:user %}
<tr> <tr>
<td>Actions</td> <td>Actions</td>
{% with request.resolver_match.namespaces.0|add:":"|add:object.getClassName|lower|add:"-edit" as editView %} {% with object.getAppName|add:":"|add:object.getClassName|lower|add:"-edit" as editView %}
{% with request.resolver_match.namespaces.0|add:":"|add:object.getClassName|lower|add:"-delete" as deleteView %} {% with object.getAppName|add:":"|add:object.getClassName|lower|add:"-delete" as deleteView %}
<td><a href="{% url editView object.getPK %}">Edit object<a/>, <a href="{% url deleteView object.getPK %}">Delete object</a></td> <td><a href="{% url editView object.getPK %}">Edit object<a/>, <a href="{% url deleteView object.getPK %}">Delete object</a></td>
{% endwith %} {% endwith %}
{% endwith %} {% endwith %}

View File

@ -34,6 +34,9 @@ class WhoisObject(models.Model):
def __str__(self): def __str__(self):
return self.handle return self.handle
def getAppName(self):
return "whoisdb"
def getClassName(self): def getClassName(self):
return self._meta.object_name return self._meta.object_name