mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Reworked relationship between devices and clusters
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.4 on 2017-08-16 19:27
|
||||
# Generated by Django 1.11.4 on 2017-08-16 21:06
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import dcim.fields
|
||||
@@ -13,9 +13,9 @@ class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('ipam', '0018_remove_service_uniqueness_constraint'),
|
||||
('tenancy', '0003_unicode_literals'),
|
||||
('dcim', '0041_napalm_integration'),
|
||||
('ipam', '0018_remove_service_uniqueness_constraint'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@@ -27,7 +27,6 @@ class Migration(migrations.Migration):
|
||||
('last_updated', models.DateTimeField(auto_now=True)),
|
||||
('name', models.CharField(max_length=100, unique=True)),
|
||||
('comments', models.TextField(blank=True)),
|
||||
('devices', models.ManyToManyField(to='dcim.Device')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['name'],
|
||||
|
||||
@@ -89,9 +89,6 @@ class Cluster(CreatedUpdatedModel, CustomFieldModel):
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
devices = models.ManyToManyField(
|
||||
to='dcim.Device'
|
||||
)
|
||||
comments = models.TextField(
|
||||
blank=True
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@ from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
from django.views.generic import View
|
||||
|
||||
from dcim.models import Device
|
||||
from utilities.views import (
|
||||
BulkDeleteView, BulkEditView, BulkImportView, ComponentCreateView, ComponentDeleteView, ComponentEditView,
|
||||
ObjectDeleteView, ObjectEditView, ObjectListView,
|
||||
@@ -95,9 +96,11 @@ class ClusterView(View):
|
||||
def get(self, request, pk):
|
||||
|
||||
cluster = get_object_or_404(Cluster, pk=pk)
|
||||
devices = Device.objects.filter(cluster=cluster)
|
||||
|
||||
return render(request, 'virtualization/cluster.html', {
|
||||
'cluster': cluster,
|
||||
'devices': devices,
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user