mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Fixes #10803: Fix exception when ordering contacts by number of assignments
This commit is contained in:
parent
a25ee66150
commit
7990cfb078
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
* [#10282](https://github.com/netbox-community/netbox/issues/10282) - Enforce advisory locks when allocating available IP addresses to prevent race conditions
|
* [#10282](https://github.com/netbox-community/netbox/issues/10282) - Enforce advisory locks when allocating available IP addresses to prevent race conditions
|
||||||
* [#10770](https://github.com/netbox-community/netbox/issues/10282) - Fix social authentication for new users
|
* [#10770](https://github.com/netbox-community/netbox/issues/10282) - Fix social authentication for new users
|
||||||
|
* [#10803](https://github.com/netbox-community/netbox/issues/10803) - Fix exception when ordering contacts by number of assignments
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -188,6 +188,8 @@ class ContactGroupView(generic.ObjectView):
|
|||||||
|
|
||||||
contacts = Contact.objects.restrict(request.user, 'view').filter(
|
contacts = Contact.objects.restrict(request.user, 'view').filter(
|
||||||
group=instance
|
group=instance
|
||||||
|
).annotate(
|
||||||
|
assignment_count=count_related(ContactAssignment, 'contact')
|
||||||
)
|
)
|
||||||
contacts_table = tables.ContactTable(contacts, user=request.user, exclude=('group',))
|
contacts_table = tables.ContactTable(contacts, user=request.user, exclude=('group',))
|
||||||
contacts_table.configure(request)
|
contacts_table.configure(request)
|
||||||
@ -338,14 +340,18 @@ class ContactBulkImportView(generic.BulkImportView):
|
|||||||
|
|
||||||
|
|
||||||
class ContactBulkEditView(generic.BulkEditView):
|
class ContactBulkEditView(generic.BulkEditView):
|
||||||
queryset = Contact.objects.all()
|
queryset = Contact.objects.annotate(
|
||||||
|
assignment_count=count_related(ContactAssignment, 'contact')
|
||||||
|
)
|
||||||
filterset = filtersets.ContactFilterSet
|
filterset = filtersets.ContactFilterSet
|
||||||
table = tables.ContactTable
|
table = tables.ContactTable
|
||||||
form = forms.ContactBulkEditForm
|
form = forms.ContactBulkEditForm
|
||||||
|
|
||||||
|
|
||||||
class ContactBulkDeleteView(generic.BulkDeleteView):
|
class ContactBulkDeleteView(generic.BulkDeleteView):
|
||||||
queryset = Contact.objects.all()
|
queryset = Contact.objects.annotate(
|
||||||
|
assignment_count=count_related(ContactAssignment, 'contact')
|
||||||
|
)
|
||||||
filterset = filtersets.ContactFilterSet
|
filterset = filtersets.ContactFilterSet
|
||||||
table = tables.ContactTable
|
table = tables.ContactTable
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user