From 15595f25ea46e18357927f0fbd0a0865fb428efd Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Wed, 20 Nov 2024 11:50:18 -0500 Subject: [PATCH] Set as_representation=True in more cases --- arches/app/models/models.py | 6 +++++- arches/app/models/serializers.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arches/app/models/models.py b/arches/app/models/models.py index 3ce6350e06..ca37b477d9 100644 --- a/arches/app/models/models.py +++ b/arches/app/models/models.py @@ -1652,7 +1652,11 @@ def refresh_from_db(self, using=None, fields=None, from_queryset=None): root_nodes := getattr(self, "_fetched_root_nodes", set()) ): aliases = [n.alias for n in root_nodes] - from_queryset = self.__class__.as_model(self.graph.slug, only=aliases) + from_queryset = self.__class__.as_model( + self.graph.slug, + only=aliases, + as_representation=getattr(self, "_as_representation", False), + ) super().refresh_from_db(using, fields, from_queryset) # Copy over annotations and annotated tiles. refreshed_resource = from_queryset[0] diff --git a/arches/app/models/serializers.py b/arches/app/models/serializers.py index f379e2095e..54746e8ddd 100644 --- a/arches/app/models/serializers.py +++ b/arches/app/models/serializers.py @@ -150,5 +150,5 @@ def create(self, validated_data): graph_slug=self.__class__.Meta.graph_slug, only=None if meta.nodegroups == "__all__" else meta.nodegroups, ).get(pk=instance_without_tile_data.pk) - # TODO: fullest/hydrated version of tile data not yet appearing? + instance_from_factory._as_representation = True return self.update(instance_from_factory, validated_data)