Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

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