File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,9 +90,26 @@ delete_translations
9090
9191.. method :: delete_translations()
9292
93- Deletes all :term: `Translations Model ` instances in a queryset, without
93+ Deletes all :term: `Translations Model ` instances matched by a queryset, without
9494 deleting the :term: `Shared Model ` instances.
9595
96+ This can be used to target specific translations of specific objects for deletion.
97+ For instance::
98+
99+ # Delete English translation of all objects that have field == "foo"
100+ MyModel.objects.language('en').filter(field='foo').delete_translations()
101+
102+ # Delete all translations but English for object with id 42
103+ MyModel.objects.language('all').exclude(language_code='en').filter(pk=42).delete_translations()
104+
105+ .. warning :: It is an error to delete all translations of an instance. This will
106+ cause the object to be unreachable through translation-aware queries
107+ and invisible in the admin panel.
108+
109+ If you delete all translations and re-create one immediately after,
110+ remember to enclose the whole process in a transaction to avoid
111+ the possibility of leaving the object unreachable.
112+
96113.. _select_related-public :
97114
98115select_related
You can’t perform that action at this time.
0 commit comments