17170 update api, detail view, graphql

This commit is contained in:
Arthur 2025-03-12 13:06:53 -07:00
parent 771a9a2d4f
commit c7827c7960
3 changed files with 8 additions and 4 deletions

View File

@ -18,8 +18,12 @@
<h2 class="card-header">{% trans "Contact" %}</h2>
<table class="table table-hover attr-table">
<tr>
<th scope="row">{% trans "Group" %}</th>
<td>{{ object.group|linkify|placeholder }}</td>
<th scope="row">{% trans "Groups" %}</th>
<td>
{% for group in object.groups.all %}
{{ group|linkify|placeholder }}{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Name" %}</th>

View File

@ -43,7 +43,7 @@ class ContactRoleSerializer(NetBoxModelSerializer):
class ContactSerializer(NetBoxModelSerializer):
group = ContactGroupSerializer(nested=True, required=False, allow_null=True, default=None)
groups = ContactGroupSerializer(many=True, nested=True, required=False, allow_null=True, default=None)
class Meta:
model = Contact

View File

@ -97,7 +97,7 @@ class TenantGroupType(OrganizationalObjectType):
@strawberry_django.type(models.Contact, fields='__all__', filters=ContactFilter)
class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
group: Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')] | None
groups: List[Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')]]
@strawberry_django.type(models.ContactRole, fields='__all__', filters=ContactRoleFilter)