There are the following models:
class ARM (models.Model): class Meta(): db_table = 'arm' network = models.ManyToManyField(Network) arm_configuration_name = models.TextField() class Network(models.Model): class Meta(): db_table = 'network' network_name = models.TextField() In the template, pass it like this (views.py)
def Display_example(request): arms = ARM.objects.all() rooms = Room.objects.all() network = Network.objects.all() server = Server.objects.all() return render(request, 'example.html', {'arms': arms ' network': network}) It is necessary to display all the information about the AWP in the template (including and which network it belongs to). I try this:
{% for arm in arms %} <div> <p>{{ arm.arm_configuration_name }}</p> {% for network in networks %} {% if network.id == arm.network %} <p>{{ network.network_name }}</p> {% endif %} {% endfor %} </div> {% endfor %} But information about which network the AWP belongs to is not displayed. Do not quite understand why.