diff --git a/arkindex/documents/serializers/elements.py b/arkindex/documents/serializers/elements.py index 4afac14db2e5b777ea0ceafef1a869c63297ee43..90adf646d1b0add5934d60dffbde6c94629c8f88 100644 --- a/arkindex/documents/serializers/elements.py +++ b/arkindex/documents/serializers/elements.py @@ -361,7 +361,9 @@ class ElementCreateSerializer(ElementLightSerializer): return corpora = Corpus.objects.writable(self.context['request'].user) self.fields['corpus'].queryset = corpora.prefetch_related('types') - self.fields['parent'].queryset = Element.objects.filter(corpus__in=corpora) + + # Avoid a stale read issue when creating a child on a freshly created parent + self.fields['parent'].queryset = Element.objects.filter(corpus__in=corpora).using('default') def validate(self, data): errors = defaultdict(list)