core: add num_pk to group for applications that need a numerical group id

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

#2497
This commit is contained in:
Jens Langhammer
2022-03-22 21:37:11 +01:00
parent 9ad4c736f1
commit 0c2b32da31
6 changed files with 1866 additions and 2287 deletions

View File

@ -4,7 +4,7 @@ from json import loads
from django.db.models.query import QuerySet
from django_filters.filters import CharFilter, ModelMultipleChoiceFilter
from django_filters.filterset import FilterSet
from rest_framework.fields import CharField, JSONField
from rest_framework.fields import CharField, IntegerField, JSONField
from rest_framework.serializers import ListSerializer, ModelSerializer, ValidationError
from rest_framework.viewsets import ModelViewSet
from rest_framework_guardian.filters import ObjectPermissionsFilter
@ -46,11 +46,14 @@ class GroupSerializer(ModelSerializer):
)
parent_name = CharField(source="parent.name", read_only=True)
num_pk = IntegerField(read_only=True)
class Meta:
model = Group
fields = [
"pk",
"num_pk",
"name",
"is_superuser",
"parent",