Commit d2d6176a authored by sebastien letort's avatar sebastien letort
Browse files

The owner of an app can run job on unpublished webapp (it appears in the list...

The owner of an app can run job on unpublished webapp (it appears in the list of available version).
parent 0c053a2d
......@@ -36,7 +36,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.db import transaction
from django.db.models import Count
from django.db.models import Count, Q
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect, FileResponse, Http404
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse, reverse_lazy
......@@ -1182,13 +1182,17 @@ class JobCreate(AllAccessMixin, SuccessMessageMixin, CreateView):
else:
readme_file = None
# select the list of versions to be displayed
versions = natsort.versorted(set(v for v, in WebappVersion.objects
.filter(webapp=webapp, state__in=( WebappVersion.SANDBOX,
# select the versions published or all if the app belongs to the user
# and in one of the 3 states SANDBOX,COMMITTED or READY
o_versions = WebappVersion.objects \
.filter(Q(published=True)|Q(webapp__user=self.request.user.id),
webapp=webapp, state__in=( WebappVersion.SANDBOX,
WebappVersion.COMMITTED,
WebappVersion.READY),
published=True)
.values_list("number")))
WebappVersion.READY),) \
.values_list("number")
# the list of versions to be displayed is sorted (clever mix string+number)
versions = natsort.versorted(set(v for v, in o_versions))
# also list 'sandbox' if the sandbox is running and if the current user
# is allowed to use the sandbox
......
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