Fix issue with save on translation form
The translation was not being saved before adding to the parent project.
This surfaced an issue when the database is different, like in the case
where we use a database router to send read/write operations to
different databases.
@@ -614,12 +614,14 @@ class TranslationBaseForm(forms.Form):
)
return queryset
- def save(self):
- project = self.parent.translations.add(self.translation)
+ def save(self, commit=True):
+ if commit:
+ self.translation.save()
+ self.parent.translations.add(self.translation)
# Run symlinking and other sync logic to make sure we are in a good
# state.
self.parent.save()
- return project
+ return self.parent
class TranslationForm(SettingsOverrideObject):
