Commit e252d8d4 authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Bug fix: bad redirection on success

The redirection in case of success was wrong. I changed it to redirect
to the webapp update page.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <>
parent e0d59963
......@@ -216,7 +216,7 @@ class WebappUpdate(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
def get_success_url(self):
"""If successful redirect to the same page"""
return reverse('main:webapp_add_update', args=(self.object.docker_name,))
return reverse('main:webapp_update', args=(self.object.docker_name,))
def get_object(self):
"""Returns the object according to its docker name or a 404 error"""
......@@ -233,6 +233,7 @@ class WebappUpdate(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
def form_valid(self, form):
"""Save data coming from the form in the database """
obj =
user = User.objects.get(username=form.cleaned_data['owner'])
obj.user_id =
......@@ -245,10 +246,10 @@ class WebappUpdate(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
messages.success(self.request, self.success_message)
return redirect('main:user_webapp_list', self.request.user.username)
return super(WebappUpdate, self).form_valid(form)
return super().form_valid(form)
except User.DoesNotExist:
messages.error(self.request, self.error_message)
return super(WebappUpdate, self).form_invalid(form)
return super().form_invalid(form)
class WebappCreate(SuccessMessageMixin, LoginRequiredMixin, IsProviderMixin, CreateView):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment