Merge "Fix success_url parameter issue for Edit Snapshot" into stable/yoga
This commit is contained in:
commit
eb57aa5300
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.http import urlencode
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from horizon import exceptions
|
from horizon import exceptions
|
||||||
|
@ -104,11 +103,8 @@ class UpdateView(forms.ModalFormView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['snapshot'] = self.get_object()
|
context['snapshot'] = self.get_object()
|
||||||
success_url = self.request.GET.get('success_url', "")
|
|
||||||
args = (self.kwargs['snapshot_id'],)
|
args = (self.kwargs['snapshot_id'],)
|
||||||
params = urlencode({"success_url": success_url})
|
context['submit_url'] = reverse(self.submit_url, args=args)
|
||||||
context['submit_url'] = "?".join([reverse(self.submit_url, args=args),
|
|
||||||
params])
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
|
@ -117,12 +113,6 @@ class UpdateView(forms.ModalFormView):
|
||||||
'name': snapshot.name,
|
'name': snapshot.name,
|
||||||
'description': snapshot.description}
|
'description': snapshot.description}
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
success_url = self.request.GET.get(
|
|
||||||
"success_url",
|
|
||||||
reverse_lazy("horizon:project:snapshots:index"))
|
|
||||||
return success_url
|
|
||||||
|
|
||||||
|
|
||||||
class DetailView(tabs.TabView):
|
class DetailView(tabs.TabView):
|
||||||
tab_group_class = vol_snapshot_tabs.SnapshotDetailTabs
|
tab_group_class = vol_snapshot_tabs.SnapshotDetailTabs
|
||||||
|
|
Loading…
Reference in New Issue