mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
17170 fixes
This commit is contained in:
parent
c7827c7960
commit
e1f8ff169c
@ -48,7 +48,7 @@ class ContactSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = Contact
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'group', 'name', 'title', 'phone', 'email', 'address', 'link',
|
||||
'id', 'url', 'display_url', 'display', 'groups', 'name', 'title', 'phone', 'email', 'address', 'link',
|
||||
'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
]
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
@ -68,9 +68,9 @@ class ContactFilterSet(NetBoxModelFilterSet):
|
||||
)
|
||||
group = TreeNodeMultipleChoiceFilter(
|
||||
queryset=ContactGroup.objects.all(),
|
||||
field_name='groups__slug',
|
||||
lookup_expr='in',
|
||||
field_name='groups',
|
||||
to_field_name='slug',
|
||||
lookup_expr='in',
|
||||
label=_('Contact group (slug)'),
|
||||
)
|
||||
|
||||
@ -112,7 +112,6 @@ class ContactAssignmentFilterSet(NetBoxModelFilterSet):
|
||||
group = TreeNodeMultipleChoiceFilter(
|
||||
queryset=ContactGroup.objects.all(),
|
||||
field_name='contact__groups__slug',
|
||||
lookup_expr='in',
|
||||
to_field_name='slug',
|
||||
label=_('Contact group (slug)'),
|
||||
)
|
||||
|
@ -183,20 +183,22 @@ class ContactTest(APIViewTestCases.APIViewTestCase):
|
||||
)
|
||||
|
||||
contacts = (
|
||||
Contact(name='Contact 1', group=contact_groups[0]),
|
||||
Contact(name='Contact 2', group=contact_groups[0]),
|
||||
Contact(name='Contact 3', group=contact_groups[0]),
|
||||
Contact(name='Contact 1'),
|
||||
Contact(name='Contact 2'),
|
||||
Contact(name='Contact 3'),
|
||||
)
|
||||
Contact.objects.bulk_create(contacts)
|
||||
contacts[0].groups.add(contact_groups[0])
|
||||
contacts[1].groups.add(contact_groups[0])
|
||||
|
||||
cls.create_data = [
|
||||
{
|
||||
'name': 'Contact 4',
|
||||
'group': contact_groups[1].pk,
|
||||
'groups': [contact_groups[1].pk],
|
||||
},
|
||||
{
|
||||
'name': 'Contact 5',
|
||||
'group': contact_groups[1].pk,
|
||||
'groups': [contact_groups[1].pk],
|
||||
},
|
||||
{
|
||||
'name': 'Contact 6',
|
||||
|
@ -311,11 +311,14 @@ class ContactAssignmentTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
ContactRole.objects.bulk_create(contact_roles)
|
||||
|
||||
contacts = (
|
||||
Contact(name='Contact 1', group=contact_groups[0]),
|
||||
Contact(name='Contact 2', group=contact_groups[1]),
|
||||
Contact(name='Contact 3', group=contact_groups[2]),
|
||||
Contact(name='Contact 1'),
|
||||
Contact(name='Contact 2'),
|
||||
Contact(name='Contact 3'),
|
||||
)
|
||||
Contact.objects.bulk_create(contacts)
|
||||
contacts[0].groups.add(contact_groups[0])
|
||||
contacts[1].groups.add(contact_groups[1])
|
||||
contacts[2].groups.add(contact_groups[2])
|
||||
|
||||
assignments = (
|
||||
ContactAssignment(object=sites[0], contact=contacts[0], role=contact_roles[0]),
|
||||
|
Loading…
Reference in New Issue
Block a user