core: include parent group name

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-05 00:11:17 +01:00
parent e587c53e18
commit 4a89be3048
3 changed files with 9 additions and 3 deletions

View file

@ -2,8 +2,8 @@
from django.db.models.query import QuerySet
from django_filters.filters import ModelMultipleChoiceFilter
from django_filters.filterset import FilterSet
from rest_framework.fields import CharField, JSONField
from rest_framework.serializers import ListSerializer, ModelSerializer
from rest_framework.fields import CharField, JSONField, SerializerMethodField
from rest_framework.serializers import ListSerializer, ModelSerializer, Serializer
from rest_framework.viewsets import ModelViewSet
from rest_framework_guardian.filters import ObjectPermissionsFilter
@ -42,6 +42,7 @@ class GroupSerializer(ModelSerializer):
users_obj = ListSerializer(
child=GroupMemberSerializer(), read_only=True, source="users", required=False
)
parent_name = CharField(source="parent.name", read_only=True)
class Meta:
@ -51,6 +52,7 @@ class GroupSerializer(ModelSerializer):
"name",
"is_superuser",
"parent",
"parent_name",
"users",
"attributes",
"users_obj",

View file

@ -21437,6 +21437,9 @@ components:
type: string
format: uuid
nullable: true
parent_name:
type: string
readOnly: true
users:
type: array
items:
@ -21452,6 +21455,7 @@ components:
required:
- name
- parent
- parent_name
- pk
- users
- users_obj

View file

@ -78,7 +78,7 @@ export class GroupListPage extends TablePage<Group> {
row(item: Group): TemplateResult[] {
return [
html`${item.name}`,
html`${item.parent || t`-`}`,
html`${item.parentName || t`-`}`,
html`${Array.from(item.users || []).length}`,
html`${item.isSuperuser ? t`Yes` : t`No`}`,
html` <ak-forms-modal>