Ejemplo n.º 1
0
def status_add(request, response_format='html'):
    "Status add"

    if request.POST:
        form = ChangeSetStatusForm(request.user.profile, request.POST)
        if form.is_valid():
            status = form.save()
            return HttpResponseRedirect(reverse('changes_status_view', args=[status.id]))
    else:
        form = ChangeSetStatusForm(request.user.profile)

    context = _get_default_context(request)
    context.update({'form': form})

    return render_to_response('changes/status_add', context,
                              context_instance=RequestContext(request), response_format=response_format)
Ejemplo n.º 2
0
def status_edit(request, status_id, response_format='html'):
    "Status edit"

    status = get_object_or_404(ChangeSetStatus, pk=status_id)

    if request.POST:
        form = ChangeSetStatusForm(
            request.user.profile, request.POST, instance=status)
        if form.is_valid():
            status = form.save()
            return HttpResponseRedirect(reverse('changes_status_view', args=[status.id]))
    else:
        form = ChangeSetStatusForm(request.user.profile, instance=status)

    context = _get_default_context(request)
    context.update({'status': status, 'form': form})

    return render_to_response('changes/status_edit', context,
                              context_instance=RequestContext(request), response_format=response_format)
Ejemplo n.º 3
0
def status_add(request, response_format='html'):
    "Status add"

    if request.POST:
        form = ChangeSetStatusForm(request.user.profile, request.POST)
        if form.is_valid():
            status = form.save()
            return HttpResponseRedirect(
                reverse('changes_status_view', args=[status.id]))
    else:
        form = ChangeSetStatusForm(request.user.profile)

    context = _get_default_context(request)
    context.update({'form': form})

    return render_to_response('changes/status_add',
                              context,
                              context_instance=RequestContext(request),
                              response_format=response_format)
Ejemplo n.º 4
0
def status_edit(request, status_id, response_format='html'):
    "Status edit"

    status = get_object_or_404(ChangeSetStatus, pk=status_id)

    if request.POST:
        form = ChangeSetStatusForm(request.user.profile,
                                   request.POST,
                                   instance=status)
        if form.is_valid():
            status = form.save()
            return HttpResponseRedirect(
                reverse('changes_status_view', args=[status.id]))
    else:
        form = ChangeSetStatusForm(request.user.profile, instance=status)

    context = _get_default_context(request)
    context.update({'status': status, 'form': form})

    return render_to_response('changes/status_edit',
                              context,
                              context_instance=RequestContext(request),
                              response_format=response_format)