diff --git a/nsupdate/main/templates/main/overview.html b/nsupdate/main/templates/main/overview.html index faa2ebd..c3bfc68 100644 --- a/nsupdate/main/templates/main/overview.html +++ b/nsupdate/main/templates/main/overview.html @@ -50,27 +50,31 @@
{% trans "Abuse" %} {% endif %} - {{ host.get_ipv4|default_if_none:_("none")}} + {% with ipv4=host.get_ipv4 %} + {{ ipv4|default_if_none:_("none")}}
- {% if host.last_update_ipv4 and host.get_ipv4 %} - ({{ host.last_update_ipv4|naturaltime }}, - {% if not host.tls_update_ipv4 %} - {% trans "no" %} {% else %} - {% endif %}{% trans "TLS" %}) - {% elif host.get_ipv4 %} - ({% trans "unknown" %}) + {% if host.last_update_ipv4 and ipv4 %} + ({{ host.last_update_ipv4|naturaltime }}, + {% if not host.tls_update_ipv4 %} + {% trans "no" %} {% else %} + {% endif %}{% trans "TLS" %}) + {% elif ipv4 %} + ({% trans "unknown" %}) {% endif %} + {% endwith %} - {{ host.get_ipv6|default_if_none:_("none") }} + {% with ipv6=host.get_ipv6 %} + {{ ipv6|default_if_none:_("none") }}
- {% if host.last_update_ipv6 and host.get_ipv6 %} - ({{ host.last_update_ipv6|naturaltime }}, - {% if not host.tls_update_ipv6 %} - {% trans "no" %} {% else %} - {% endif %}{% trans "TLS" %}) - {% elif host.get_ipv6 %} - ({% trans "unknown" %}) + {% if host.last_update_ipv6 and ipv6 %} + ({{ host.last_update_ipv6|naturaltime }}, + {% if not host.tls_update_ipv6 %} + {% trans "no" %} {% else %} + {% endif %}{% trans "TLS" %}) + {% elif ipv6 %} + ({% trans "unknown" %}) {% endif %} + {% endwith %} {% empty %} diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py index 92722b5..c40297e 100644 --- a/nsupdate/main/views.py +++ b/nsupdate/main/views.py @@ -191,11 +191,15 @@ class OverviewView(TemplateView): def get_context_data(self, **kwargs): context = super(OverviewView, self).get_context_data(**kwargs) context['nav_overview'] = True - context['hosts'] = Host.objects.filter(created_by=self.request.user) + context['hosts'] = Host.objects.filter(created_by=self.request.user).select_related("domain")\ + .only("name", "comment", "available", "client_faults", "server_faults", "abuse_blocked", "abuse", + "last_update_ipv4", "tls_update_ipv4", "last_update_ipv6", "tls_update_ipv6", "domain__name") context['your_domains'] = Domain.objects.filter( - created_by=self.request.user) + created_by=self.request.user).select_related("created_by__username")\ + .only("name", "public", "available", "comment", "created_by__username") context['public_domains'] = Domain.objects.filter( - public=True).exclude(created_by=self.request.user) + public=True).exclude(created_by=self.request.user).select_related("created_by")\ + .only("name", "public", "available", "comment", "created_by__username") return context