Skip to content

Commit

Permalink
update serializer for documento
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-bellenghi committed Oct 31, 2024
1 parent 38fa23f commit 9ea3b9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changelog
- Override BandoView: in io-Comune we add new children on Folder Deepening content
and we need to proper handle it
[lucabel]
- update serializer for documento ct adding more information about modulo children
[lucabel]

6.2.22 (2024-10-30)
-------------------
Expand Down
11 changes: 11 additions & 0 deletions src/design/plone/contenttypes/restapi/serializers/documento.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,16 @@ def __call__(self, version=None, include_items=True):
result = super(DocumentoSerializer, self).__call__(
version=version, include_items=include_items
)
# Una via alternativa era l'injection di fullobject nella request ma
# mi pare una cosa cattiva da fare
brain_moduli = [
x for x in self.context.getFolderContents() if x.portal_type == "Modulo"
]
result["moduli_del_documento"] = []
for brain in brain_moduli:
modulo = brain.getObject()
result["moduli_del_documento"].append(
getMultiAdapter((modulo, self.request), ISerializeToJson)()
)
result["servizi_collegati"] = self.get_services()
return result

0 comments on commit 9ea3b9d

Please sign in to comment.