Example #1
0
def edit(request, observation_id, summary_id):
    """
    The view that returns the Id filed from the fault summary table.
    """

    if request.method == 'POST':
        if observation_id and summary_id:
            o = get_object_or_404(models.Observations, pk=observation_id)
            o.summary_id = summary_id
            form = Observation(request.POST, instance=o)
        else:
            form = Observation(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("obsform_form.html", {
                'form': form,
                'success': 'Your observation was saved'
            },
                                      context_instance=RequestContext(request))
    else:
        o = get_object_or_404(models.Observations, pk=observation_id)
        o.summary_id = summary_id

        form = Observation(instance=o)

    return render_to_response('obsform_form.html', {'form': form},
                              context_instance=RequestContext(request))
Example #2
0
def obsform(request):
    if request.method == "POST":
        form = Observation(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response(
                "obsform_form.html",
                {"form": form, "success": "Your observation was saved"},
                context_instance=RequestContext(request),
            )
    else:
        form = Observation()
    return render_to_response("obsform_form.html", {"form": form}, context_instance=RequestContext(request))
Example #3
0
def obsform(request):
    if request.method == 'POST':
        form = Observation(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("obsform_form.html",
                      {'form': form,
                       'success' : 'Your observation was saved'},
                context_instance=RequestContext(request))
    else:
        form = Observation()
    return render_to_response('obsform_form.html', {'form': form},
                              context_instance=RequestContext(request))
Example #4
0
def edit(request, observation_id, summary_id):
    """
    The view that returns the Id filed from the fault summary table.
    """

    if request.method == "POST":
        if observation_id and summary_id:
            o = get_object_or_404(models.Observations, pk=observation_id)
            o.summary_id = summary_id
            form = Observation(request.POST, instance=o)
        else:
            form = Observation(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response(
                "obsform_form.html",
                {"form": form, "success": "Your observation was saved"},
                context_instance=RequestContext(request),
            )
    else:
        o = get_object_or_404(models.Observations, pk=observation_id)
        o.summary_id = summary_id

        form = Observation(instance=o)

    return render_to_response("obsform_form.html", {"form": form}, context_instance=RequestContext(request))
Example #5
0
def obsform(request):
    if request.method == 'POST':
        form = Observation(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("obsform_form.html", {
                'form': form,
                'success': 'Your observation was saved'
            },
                                      context_instance=RequestContext(request))
    else:
        form = Observation()
    return render_to_response('obsform_form.html', {'form': form},
                              context_instance=RequestContext(request))