only show "(unkown)" in overview when hosts has this record, add some trans tags

This commit is contained in:
elnappo 2014-12-05 19:38:26 +01:00
parent 1d262b4f1e
commit cbab1a5d17
No known key found for this signature in database
GPG Key ID: 3AAF323515F3F056
2 changed files with 16 additions and 16 deletions

View File

@ -277,9 +277,9 @@ class Host(models.Model):
try: try:
return dnstools.query_ns(self.get_fqdn(), record) return dnstools.query_ns(self.get_fqdn(), record)
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
return 'none' return None
except (dns.resolver.NoNameservers, dns.resolver.Timeout, dnstools.NameServerNotAvailable): except (dns.resolver.NoNameservers, dns.resolver.Timeout, dnstools.NameServerNotAvailable):
return 'error' return _('error')
def get_ipv4(self): def get_ipv4(self):
return self.get_ip('ipv4') return self.get_ip('ipv4')

View File

@ -45,31 +45,31 @@
<td>{{ host.available|yesno }}</td> <td>{{ host.available|yesno }}</td>
<td>{{ host.client_faults }} / {{ host.server_faults }} <td>{{ host.client_faults }} / {{ host.server_faults }}
{% if host.abuse_blocked %} {% if host.abuse_blocked %}
<br><span class="label label-danger">Abuse-Blocked</span> <br><span class="label label-danger">{% trans "Abuse-Blocked" %}</span>
{% elif host.abuse %} {% elif host.abuse %}
<br><span class="label label-warning">Abuse</span> <br><span class="label label-warning">{% trans "Abuse" %}</span>
{% endif %} {% endif %}
</td> </td>
<td>{{ host.get_ipv4 }} <td>{{ host.get_ipv4|default_if_none:_("none")}}
<br> <br>
{% if host.last_update_ipv4 %} {% if host.last_update_ipv4 and host.get_ipv4 %}
({{ host.last_update_ipv4|naturaltime }}, ({{ host.last_update_ipv4|naturaltime }},
{% if not host.tls_update_ipv4 %} {% if not host.tls_update_ipv4 %}
<span class="label label-warning">no {% else %} <span class="label label-warning">{% trans "no" %} {% else %}
<span class="label label-success">{% endif %}TLS</span>) <span class="label label-success">{% endif %}{% trans "TLS" %}</span>)
{% else %} {% elif host.get_ipv4 %}
(unknown) ({% trans "unknown" %})
{% endif %} {% endif %}
</td> </td>
<td>{{ host.get_ipv6 }} <td>{{ host.get_ipv6|default_if_none:_("none") }}
<br> <br>
{% if host.last_update_ipv6 %} {% if host.last_update_ipv6 and host.get_ipv6 %}
({{ host.last_update_ipv6|naturaltime }}, ({{ host.last_update_ipv6|naturaltime }},
{% if not host.tls_update_ipv6 %} {% if not host.tls_update_ipv6 %}
<span class="label label-warning">no {% else %} <span class="label label-warning">{% trans "no" %} {% else %}
<span class="label label-success">{% endif %}TLS</span>) <span class="label label-success">{% endif %}{% trans "TLS" %}</span>)
{% else %} {% elif host.get_ipv6 %}
(unknown) ({% trans "unknown" %})
{% endif %} {% endif %}
</td> </td>
</tr> </tr>