Esempio n. 1
0
def down(request, id, funnel_id, action_id):
    try:
        project = request.user.participate_projects.get(id=id)
    except AttributeError:
        return redirect_to_login(request.get_full_path())

    t = get_object_or_404(FunnelAction, pk=action_id)
    form = FunnelActionForm(instance=t)
    form.fields['action'].queryset = Action.objects.filter(project=project)
    if request.method == 'POST':
        form = FunnelActionForm(request.POST, instance=t)
        if form.is_valid():
            t = form.save()
            return HttpResponseRedirect(reverse('funnel_actionlist', args=[id, funnel_id]))
    return render(request, 'datapanel/funnel/create.html', {'project': project, 'form': form})
Esempio n. 2
0
def create(request, id, funnel_id):
    try:
        project = request.user.participate_projects.get(id=id)
    except AttributeError:
        return redirect_to_login(request.get_full_path())

    funnel = Funnel.objects.get(project=project, id=funnel_id)
    form = FunnelActionForm()
    form.fields['action'].queryset = Action.objects.filter(project=project)
    if request.method == "POST":
        form = FunnelActionForm(request.POST)
        if form.is_valid():
            action = form.save(commit=False)
            action.funnel = funnel
            action.save()
            return HttpResponseRedirect(reverse('funnel_actionlist', args=[id, funnel_id]))
    return render(request, 'datapanel/funnel/create.html', {'project': project,'funnel':funnel, 'form': form})
Esempio n. 3
0
def down(request, id, funnel_id, action_id):
    try:
        project = request.user.participate_projects.get(id=id)
    except AttributeError:
        return redirect_to_login(request.get_full_path())

    t = get_object_or_404(FunnelAction, pk=action_id)
    form = FunnelActionForm(instance=t)
    form.fields['action'].queryset = Action.objects.filter(project=project)
    if request.method == 'POST':
        form = FunnelActionForm(request.POST, instance=t)
        if form.is_valid():
            t = form.save()
            return HttpResponseRedirect(
                reverse('funnel_actionlist', args=[id, funnel_id]))
    return render(request, 'datapanel/funnel/create.html', {
        'project': project,
        'form': form
    })
Esempio n. 4
0
def create(request, id, funnel_id):
    try:
        project = request.user.participate_projects.get(id=id)
    except AttributeError:
        return redirect_to_login(request.get_full_path())

    funnel = Funnel.objects.get(project=project, id=funnel_id)
    form = FunnelActionForm()
    form.fields['action'].queryset = Action.objects.filter(project=project)
    if request.method == "POST":
        form = FunnelActionForm(request.POST)
        if form.is_valid():
            action = form.save(commit=False)
            action.funnel = funnel
            action.save()
            return HttpResponseRedirect(
                reverse('funnel_actionlist', args=[id, funnel_id]))
    return render(request, 'datapanel/funnel/create.html', {
        'project': project,
        'funnel': funnel,
        'form': form
    })