Commit 34a50b0f authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

Fix existing 'versions' not empty in the sandbox panel

When 'versions' is empty, the « From an existing version » option in
the template is hidden. However reversed() returns an iterator, which
is never False -> need to coerce versions into a list.
parent 1279f3fc
Pipeline #40394 failed with stage
in 1 minute and 25 seconds
...@@ -347,8 +347,8 @@ class WebappSandboxPanel(LoginRequiredMixin, TemplateView): ...@@ -347,8 +347,8 @@ class WebappSandboxPanel(LoginRequiredMixin, TemplateView):
for state in (WebappVersion.READY, WebappVersion.COMMITTED): for state in (WebappVersion.READY, WebappVersion.COMMITTED):
versions.update((v.number, v) for v in WebappVersion.objects.filter( versions.update((v.number, v) for v in WebappVersion.objects.filter(
webapp=context["webapp"], state=state)) webapp=context["webapp"], state=state))
context['versions'] = reversed( context['versions'] = natsort.versorted(versions.values(), key=lambda v: v.number)
natsort.versorted(versions.values(), key=lambda v: v.number)) context['versions'].reverse()
return context return context
def post(self, request, *, docker_name): def post(self, request, *, docker_name):
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