mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-26 03:11:49 +01:00
12336 make region API calls atomic (#13942)
* 12336 make region API calls atomic * 12336 switch to pg locks * 12336 add locks to all views using mptt models * 12336 fix ADVISORY_LOCK_KEYS reference * 12336 review changes * Tweak advisory lock numbering --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -3,7 +3,7 @@ from rest_framework.routers import APIRootView
|
||||
from circuits.models import Circuit
|
||||
from dcim.models import Device, Rack, Site
|
||||
from ipam.models import IPAddress, Prefix, VLAN, VRF
|
||||
from netbox.api.viewsets import NetBoxModelViewSet
|
||||
from netbox.api.viewsets import NetBoxModelViewSet, MPTTLockedMixin
|
||||
from tenancy import filtersets
|
||||
from tenancy.models import *
|
||||
from utilities.utils import count_related
|
||||
@@ -23,7 +23,7 @@ class TenancyRootView(APIRootView):
|
||||
# Tenants
|
||||
#
|
||||
|
||||
class TenantGroupViewSet(NetBoxModelViewSet):
|
||||
class TenantGroupViewSet(MPTTLockedMixin, NetBoxModelViewSet):
|
||||
queryset = TenantGroup.objects.add_related_count(
|
||||
TenantGroup.objects.all(),
|
||||
Tenant,
|
||||
@@ -58,7 +58,7 @@ class TenantViewSet(NetBoxModelViewSet):
|
||||
# Contacts
|
||||
#
|
||||
|
||||
class ContactGroupViewSet(NetBoxModelViewSet):
|
||||
class ContactGroupViewSet(MPTTLockedMixin, NetBoxModelViewSet):
|
||||
queryset = ContactGroup.objects.add_related_count(
|
||||
ContactGroup.objects.all(),
|
||||
Contact,
|
||||
|
||||
Reference in New Issue
Block a user