Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion netbox/tenancy/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ class ContactViewSet(NetBoxModelViewSet):


class ContactAssignmentViewSet(NetBoxModelViewSet):
queryset = ContactAssignment.objects.prefetch_related('object', 'contact', 'role')
queryset = ContactAssignment.objects.prefetch_related('content_type', 'object', 'contact', 'role', 'tags')
serializer_class = serializers.ContactAssignmentSerializer
filterset_class = filtersets.ContactAssignmentFilterSet
17 changes: 17 additions & 0 deletions netbox/tenancy/migrations/0014_contactassignment_ordering.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.8 on 2024-01-17 15:27

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('tenancy', '0013_gfk_indexes'),
]

operations = [
migrations.AlterModelOptions(
name='contactassignment',
options={'ordering': ('contact', 'priority', 'role', 'pk')},
),
]
2 changes: 1 addition & 1 deletion netbox/tenancy/models/contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ContactAssignment(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, Chan
clone_fields = ('content_type', 'object_id', 'role', 'priority')

class Meta:
ordering = ('priority', 'contact')
ordering = ('contact', 'priority', 'role', 'pk')
indexes = (
models.Index(fields=('content_type', 'object_id')),
)
Expand Down
2 changes: 1 addition & 1 deletion netbox/tenancy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_children(self, request, parent):
return ContactAssignment.objects.restrict(request.user, 'view').filter(
content_type=ContentType.objects.get_for_model(parent),
object_id=parent.pk
)
).order_by('priority', 'contact', 'role')

def get_table(self, *args, **kwargs):
table = super().get_table(*args, **kwargs)
Expand Down