From bca5695e9180025601b8a1370fd021b5049eb34e Mon Sep 17 00:00:00 2001 From: Tatiana Ovchinnikova Date: Thu, 14 Jul 2016 18:13:50 +0300 Subject: [PATCH] Fix improperly rendered Update Security Service modal form Update Security Service form validation works for only one time. On the second try whatever values are used, a correct ones or not, the form closes with "There was an error submitting the form. Please try again." message. It appears that form_invalid method returns broken submit url. This patch moves rendering to get_initial method to get a proper submit url for valid and invalid forms. Change-Id: I6047adaf1a0864d93272940f8d15468b1ec39426 Closes-Bug: #1585247 --- manila_ui/dashboards/project/shares/security_services/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manila_ui/dashboards/project/shares/security_services/views.py b/manila_ui/dashboards/project/shares/security_services/views.py index aa84f086..b9b45e81 100644 --- a/manila_ui/dashboards/project/shares/security_services/views.py +++ b/manila_ui/dashboards/project/shares/security_services/views.py @@ -59,11 +59,10 @@ class UpdateView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) - args = (self.get_object().id,) - context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): + self.submit_url = reverse(self.submit_url, kwargs=self.kwargs) sec_service = self.get_object() return {'sec_service_id': self.kwargs["sec_service_id"], 'name': sec_service.name,