Skip to content

Commit

Permalink
Component: Avoid using half-edited object for further actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Sep 21, 2020
1 parent 58c1311 commit 1b87fb5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion weblate/trans/views/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
ProjectSettingsForm,
TranslationDeleteForm,
)
from weblate.trans.models import Announcement, Change
from weblate.trans.models import Announcement, Change, Component
from weblate.trans.tasks import component_removal, project_removal
from weblate.trans.util import redirect_param, render
from weblate.utils import messages
Expand Down Expand Up @@ -95,6 +95,9 @@ def change_component(request, project, component):
messages.error(
request, _("Invalid settings, please check the form for errors!")
)
# Get a fresh copy of object, otherwise it will use unsaved changes
# from the failed form
obj = Component.objects.get(pk=obj.pk)
else:
form = ComponentSettingsForm(request, instance=obj)

Expand Down

0 comments on commit 1b87fb5

Please sign in to comment.