-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1469 from open-zaak/feature/1419-zaakobjecttype
new ZaakObjectType endpoints
- Loading branch information
Showing
25 changed files
with
1,976 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: EUPL-1.2 | ||
# Copyright (C) 2023 Dimpact | ||
from django.contrib import admin | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from openzaak.utils.admin import UUIDAdminMixin | ||
|
||
from ..models import ZaakObjectType | ||
from .mixins import ReadOnlyPublishedZaaktypeMixin | ||
|
||
|
||
@admin.register(ZaakObjectType) | ||
class ZaakObjectTypeAdmin( | ||
ReadOnlyPublishedZaaktypeMixin, UUIDAdminMixin, admin.ModelAdmin, | ||
): | ||
# List | ||
list_display = ( | ||
"zaaktype", | ||
"ander_objecttype", | ||
) | ||
list_filter = ("zaaktype", "ander_objecttype") | ||
search_fields = ("uuid", "relatie_omschrijving") | ||
ordering = ("zaaktype", "relatie_omschrijving") | ||
|
||
# Details | ||
fieldsets = ( | ||
( | ||
_("Algemeen"), | ||
{"fields": ("ander_objecttype", "objecttype", "relatie_omschrijving",)}, | ||
), | ||
(_("Relaties"), {"fields": ("zaaktype",)}), | ||
) | ||
raw_id_fields = ("zaaktype",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/openzaak/components/catalogi/api/serializers/zaakobjecttype.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# SPDX-License-Identifier: EUPL-1.2 | ||
# Copyright (C) 2019 - 2020 Dimpact | ||
from django.utils.translation import gettext as _ | ||
|
||
from rest_framework import serializers | ||
from rest_framework.serializers import HyperlinkedModelSerializer | ||
from vng_api_common.utils import get_help_text | ||
|
||
from ...models import ZaakObjectType | ||
from ..validators import ZaakTypeConceptValidator | ||
|
||
|
||
class ZaakObjectTypeSerializer(HyperlinkedModelSerializer): | ||
zaaktype_identificatie = serializers.SlugRelatedField( | ||
source="zaaktype", | ||
read_only=True, | ||
slug_field="identificatie", | ||
help_text=_( | ||
"Unieke identificatie van het ZAAKTYPE binnen de CATALOGUS waarin het ZAAKTYPE voorkomt." | ||
), | ||
) | ||
catalogus = serializers.HyperlinkedRelatedField( | ||
view_name="catalogus-detail", | ||
source="zaaktype.catalogus", | ||
read_only=True, | ||
lookup_field="uuid", | ||
help_text=get_help_text("catalogi.ZaakType", "catalogus"), | ||
) | ||
|
||
class Meta: | ||
model = ZaakObjectType | ||
fields = ( | ||
"url", | ||
"ander_objecttype", | ||
"objecttype", | ||
"relatie_omschrijving", | ||
"zaaktype", | ||
"zaaktype_identificatie", | ||
"resultaattypen", | ||
"statustypen", | ||
"catalogus", | ||
) | ||
extra_kwargs = { | ||
"url": {"lookup_field": "uuid"}, | ||
"zaaktype": {"lookup_field": "uuid"}, | ||
"resultaattypen": { | ||
"lookup_field": "uuid", | ||
"read_only": True, | ||
"many": True, | ||
"help_text": _("URL-referenties naar de RESULTAATTYPEN."), | ||
}, | ||
"statustypen": { | ||
"lookup_field": "uuid", | ||
"read_only": True, | ||
"many": True, | ||
"help_text": _("URL-referenties naar de STATUSTYPEN."), | ||
}, | ||
"catalogus": {"lookup_field": "uuid"}, | ||
} | ||
validators = [ZaakTypeConceptValidator()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/openzaak/components/catalogi/api/viewsets/zaakobjecttype.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# SPDX-License-Identifier: EUPL-1.2 | ||
# Copyright (C) 2023 Dimpact | ||
from rest_framework import viewsets | ||
from vng_api_common.caching import conditional_retrieve | ||
from vng_api_common.viewsets import CheckQueryParamsMixin | ||
|
||
from openzaak.utils.pagination import OptimizedPagination | ||
from openzaak.utils.permissions import AuthRequired | ||
|
||
from ...models import ZaakObjectType | ||
from ..filters import ZaakObjectTypeFilter | ||
from ..scopes import ( | ||
SCOPE_CATALOGI_FORCED_DELETE, | ||
SCOPE_CATALOGI_FORCED_WRITE, | ||
SCOPE_CATALOGI_READ, | ||
SCOPE_CATALOGI_WRITE, | ||
) | ||
from ..serializers import ZaakObjectTypeSerializer | ||
from .mixins import ZaakTypeConceptMixin | ||
|
||
|
||
@conditional_retrieve() | ||
class ZaakObjectTypeViewSet( | ||
CheckQueryParamsMixin, ZaakTypeConceptMixin, viewsets.ModelViewSet | ||
): | ||
""" | ||
Opvragen en bewerken van ZAAKOBJECTTYPEn. | ||
create: | ||
Maak een ZAAKOBJECTTYPE aan. | ||
Maak een ZAAKOBJECTTYPE aan. | ||
list: | ||
Alle ZAAKOBJECTTYPEn opvragen. | ||
Deze lijst kan gefilterd wordt met query-string parameters. | ||
retrieve: | ||
Een specifieke ZAAKOBJECTTYPE opvragen. | ||
Een specifieke ZAAKOBJECTTYPE opvragen. | ||
update: | ||
Werk een ZAAKOBJECTTYPE in zijn geheel bij. | ||
Werk een ZAAKOBJECTTYPE in zijn geheel bij. | ||
partial_update: | ||
Werk een ZAAKOBJECTTYPE deels bij. | ||
Werk een ZAAKOBJECTTYPE deels bij. | ||
destroy: | ||
Verwijder een ZAAKOBJECTTYPE. | ||
Verwijder een ZAAKOBJECTTYPE. | ||
""" | ||
|
||
queryset = ( | ||
ZaakObjectType.objects.select_related("zaaktype", "zaaktype__catalogus") | ||
.prefetch_related("resultaattypen", "statustypen") | ||
.order_by("-pk") | ||
.all() | ||
) | ||
serializer_class = ZaakObjectTypeSerializer | ||
filterset_class = ZaakObjectTypeFilter | ||
lookup_field = "uuid" | ||
pagination_class = OptimizedPagination | ||
permission_classes = (AuthRequired,) | ||
required_scopes = { | ||
"list": SCOPE_CATALOGI_READ, | ||
"retrieve": SCOPE_CATALOGI_READ, | ||
"create": SCOPE_CATALOGI_WRITE | SCOPE_CATALOGI_FORCED_WRITE, | ||
"update": SCOPE_CATALOGI_WRITE | SCOPE_CATALOGI_FORCED_WRITE, | ||
"partial_update": SCOPE_CATALOGI_WRITE | SCOPE_CATALOGI_FORCED_WRITE, | ||
"destroy": SCOPE_CATALOGI_WRITE | SCOPE_CATALOGI_FORCED_DELETE, | ||
} |
Oops, something went wrong.