Skip to content

Commit

Permalink
Set as_representation=True in more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Dec 3, 2024
1 parent dbdb1b9 commit b457931
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion arches/app/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion arches/app/models/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b457931

Please sign in to comment.