Esempio n. 1
0
def project_version_detail(request, project_slug, version_slug):
    """Project version detail page"""
    project = get_object_or_404(Project.objects.for_admin_user(request.user),
                                slug=project_slug)
    version = get_object_or_404(Version.objects.public(user=request.user,
                                                       project=project,
                                                       only_active=False),
                                slug=version_slug)

    form = VersionForm(request.POST or None, instance=version)

    if request.method == 'POST' and form.is_valid():
        version = form.save()
        if form.has_changed():
            if 'active' in form.changed_data and version.active is False:
                log.info('Removing files for version %s' % version.slug)
                clear_artifacts.delay(version_pk=version.pk)
                version.built = False
                version.save()
        url = reverse('project_version_list', args=[project.slug])
        return HttpResponseRedirect(url)

    return render_to_response('projects/project_version_detail.html', {
        'form': form,
        'project': project,
        'version': version
    },
                              context_instance=RequestContext(request))
Esempio n. 2
0
def project_version_detail(request, project_slug, version_slug):
    """Project version detail page."""
    project = get_object_or_404(
        Project.objects.for_admin_user(request.user), slug=project_slug)
    version = get_object_or_404(
        Version.objects.public(
            user=request.user, project=project, only_active=False),
        slug=version_slug)

    form = VersionForm(request.POST or None, instance=version)

    if request.method == 'POST' and form.is_valid():
        version = form.save()
        if form.has_changed():
            if 'active' in form.changed_data and version.active is False:
                log.info('Removing files for version %s', version.slug)
                broadcast(
                    type='app', task=tasks.clear_artifacts, args=[version.get_artifact_paths()])
                version.built = False
                version.save()
        url = reverse('project_version_list', args=[project.slug])
        return HttpResponseRedirect(url)

    return render(
        request, 'projects/project_version_detail.html',
        {'form': form, 'project': project, 'version': version})
Esempio n. 3
0
def project_version_detail(request, project_slug, version_slug):
    """Project version detail page"""
    project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
    version = get_object_or_404(
        Version.objects.public(user=request.user, project=project, only_active=False),
        slug=version_slug)

    form = VersionForm(request.POST or None, instance=version)

    if request.method == 'POST' and form.is_valid():
        version = form.save()
        if form.has_changed():
            if 'active' in form.changed_data and version.active is False:
                log.info('Removing files for version %s' % version.slug)
                clear_artifacts.delay(version_pk=version.pk)
                version.built = False
                version.save()
        url = reverse('project_version_list', args=[project.slug])
        return HttpResponseRedirect(url)

    return render_to_response(
        'projects/project_version_detail.html',
        {'form': form, 'project': project, 'version': version},
        context_instance=RequestContext(request)
    )
Esempio n. 4
0
def project_version_detail(request, project_slug, version_slug):
    project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
    version = get_object_or_404(
        Version.objects.public(user=request.user, project=project, only_active=False), slug=version_slug
    )

    form = VersionForm(request.POST or None, instance=version)

    if request.method == "POST" and form.is_valid():
        form.save()
        url = reverse("project_version_list", args=[project.slug])
        return HttpResponseRedirect(url)

    return render_to_response(
        "projects/project_version_detail.html",
        {"form": form, "project": project, "version": version},
        context_instance=RequestContext(request),
    )
Esempio n. 5
0
def project_version_detail(request, project_slug, version_slug):
    project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
    version = get_object_or_404(
        Version.objects.public(user=request.user, project=project, only_active=False),
        slug=version_slug)

    form = VersionForm(request.POST or None, instance=version)

    if request.method == 'POST' and form.is_valid():
        form.save()
        url = reverse('project_version_list', args=[project.slug])
        return HttpResponseRedirect(url)

    return render_to_response(
        'projects/project_version_detail.html',
        {'form': form, 'project': project, 'version': version},
        context_instance=RequestContext(request)
    )
Esempio n. 6
0
def project_version_detail(request, project_slug, version_slug):
    """Project version detail page"""
    project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
    version = get_object_or_404(
        Version.objects.public(user=request.user, project=project, only_active=False),
        slug=version_slug)

    form = VersionForm(request.POST or None, instance=version)

    if request.method == 'POST' and form.is_valid():
        form.save()
        url = reverse('project_version_list', args=[project.slug])
        return HttpResponseRedirect(url)

    return render_to_response(
        'projects/project_version_detail.html',
        {'form': form, 'project': project, 'version': version},
        context_instance=RequestContext(request)
    )