show upstream in node uplink
This commit is contained in:
parent
b84cd059df
commit
9da37855c0
3 changed files with 18 additions and 5 deletions
|
@ -16,9 +16,13 @@
|
|||
<strong>Uplink:</strong>
|
||||
{% with uplink=node.get_uplink %}
|
||||
{% if uplink %}
|
||||
<a href="{% url "mesh.node.detail" pk=uplink.node_id %}">{{ uplink.node }}</a>
|
||||
{% mesh_node uplink.node %}<br>
|
||||
{% if uplink.node == node %}
|
||||
<em>(direct)</em>
|
||||
{% trans '(is an uplink)' %}
|
||||
{% elif node.upstream %}
|
||||
{% trans 'via:' %} {% mesh_node node.upstream %}
|
||||
{% else %}
|
||||
{% trans '(direct)' %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<em>offline</em>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{% extends 'mesh/base.html' %}
|
||||
{% load i18n %}
|
||||
{% load mesh_node %}
|
||||
|
||||
{% block heading %}{% trans 'Mesh Nodes' %}{% endblock %}
|
||||
|
||||
|
@ -45,7 +46,14 @@
|
|||
<td>
|
||||
{% with uplink=node.get_uplink %}
|
||||
{% if uplink %}
|
||||
<a href="{% url "mesh.node.detail" pk=uplink.node_id %}">{{ node.uplink.node }}</a>
|
||||
{% mesh_node uplink.node %}<br>
|
||||
{% if uplink.node == node %}
|
||||
{% trans '(is an uplink)' %}
|
||||
{% elif node.upstream %}
|
||||
{% trans 'via:' %} {% mesh_node node.upstream %}
|
||||
{% else %}
|
||||
{% trans '(direct)' %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<em>offline</em>
|
||||
{% endif %}
|
||||
|
|
|
@ -15,7 +15,8 @@ class NodeListView(MeshControlMixin, ListView):
|
|||
context_object_name = "nodes"
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().prefetch_last_messages().prefetch_firmwares().prefetch_ranging_beacon()
|
||||
return (super().get_queryset().prefetch_last_messages().prefetch_firmwares()
|
||||
.prefetch_ranging_beacon().select_related("upstream"))
|
||||
|
||||
|
||||
class NodeDetailView(MeshControlMixin, DetailView):
|
||||
|
@ -25,7 +26,7 @@ class NodeDetailView(MeshControlMixin, DetailView):
|
|||
context_object_name = "node"
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().prefetch_last_messages().prefetch_firmwares()
|
||||
return super().get_queryset().prefetch_last_messages().prefetch_firmwares().select_related("upstream")
|
||||
|
||||
|
||||
class NodeEditView(MeshControlMixin, SuccessMessageMixin, UpdateView):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue