Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multitenancy #393

Merged
merged 16 commits into from
Jul 27, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tenancy-related API cleanup
jeremystretch committed Jul 27, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 300e67388b2f8d6fd81f76065e9eebbb973221aa
4 changes: 2 additions & 2 deletions netbox/circuits/api/views.py
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ class CircuitListView(generics.ListAPIView):
"""
List circuits (filterable)
"""
queryset = Circuit.objects.select_related('type', 'provider', 'site', 'interface__device')
queryset = Circuit.objects.select_related('type', 'tenant', 'provider', 'site', 'interface__device')
serializer_class = serializers.CircuitSerializer
filter_class = CircuitFilter

@@ -51,5 +51,5 @@ class CircuitDetailView(generics.RetrieveAPIView):
"""
Retrieve a single circuit
"""
queryset = Circuit.objects.select_related('type', 'provider', 'site', 'interface__device')
queryset = Circuit.objects.select_related('type', 'tenant', 'provider', 'site', 'interface__device')
serializer_class = serializers.CircuitSerializer
13 changes: 7 additions & 6 deletions netbox/dcim/api/views.py
Original file line number Diff line number Diff line change
@@ -27,15 +27,15 @@ class SiteListView(generics.ListAPIView):
"""
List all sites
"""
queryset = Site.objects.all()
queryset = Site.objects.select_related('tenant')
serializer_class = serializers.SiteSerializer


class SiteDetailView(generics.RetrieveAPIView):
"""
Retrieve a single site
"""
queryset = Site.objects.all()
queryset = Site.objects.select_related('tenant')
serializer_class = serializers.SiteSerializer


@@ -68,7 +68,7 @@ class RackListView(generics.ListAPIView):
"""
List racks (filterable)
"""
queryset = Rack.objects.select_related('site')
queryset = Rack.objects.select_related('site', 'tenant')
serializer_class = serializers.RackSerializer
filter_class = filters.RackFilter

@@ -77,7 +77,7 @@ class RackDetailView(generics.RetrieveAPIView):
"""
Retrieve a single rack
"""
queryset = Rack.objects.select_related('site')
queryset = Rack.objects.select_related('site', 'tenant')
serializer_class = serializers.RackDetailSerializer


@@ -193,8 +193,9 @@ class DeviceListView(generics.ListAPIView):
"""
List devices (filterable)
"""
queryset = Device.objects.select_related('device_type__manufacturer', 'device_role', 'platform', 'rack__site')\
.prefetch_related('primary_ip4__nat_outside', 'primary_ip6__nat_outside')
queryset = Device.objects.select_related('device_type__manufacturer', 'device_role', 'tenant', 'platform',
'rack__site').prefetch_related('primary_ip4__nat_outside',
'primary_ip6__nat_outside')
serializer_class = serializers.DeviceSerializer
filter_class = filters.DeviceFilter
renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES + [BINDZoneRenderer, FlatJSONRenderer]