def editReporter(request, reporter_pk):
    reporter = get_object_or_404(Contact, pk=reporter_pk)
    reporter_form = EditReporterForm(instance=reporter)
    if request.method == 'POST':
        reporter_form = EditReporterForm(instance=reporter, data=request.POST)
        if reporter_form.is_valid():
            reporter_form.save()
        else:
            return render_to_response(
                'ureport/partials/contacts/edit_reporter.html', {
                    'reporter_form': reporter_form,
                    'reporter': reporter
                },
                context_instance=RequestContext(request))
        return render_to_response(
            'ureport/partials/contacts/contacts_row.html', {
                'object': Contact.objects.get(pk=reporter_pk),
                'selectable': True
            },
            context_instance=RequestContext(request))
    else:
        return render_to_response(
            'ureport/partials/contacts/edit_reporter.html', {
                'reporter_form': reporter_form,
                'reporter': reporter
            },
            context_instance=RequestContext(request))
def editReporter(request, reporter_pk):
    reporter = get_object_or_404(Contact, pk=reporter_pk)
    reporter_form = EditReporterForm(instance=reporter)
    if request.method == 'POST':
        reporter_form = EditUreporterForm(request.POST)
        if reporter_form.is_valid():
            reporter_form.save(reporter)
        else:
            return render_to_response('ureport/partials/contacts/edit_reporter.html'
                , {'reporter_form': reporter_form, 'reporter'
                : reporter},
                                      context_instance=RequestContext(request))
        return HttpResponse('saved')

    else:
        return render_to_response('ureport/partials/contacts/edit_reporter.html'
            , {'reporter_form': reporter_form,
               'reporter': reporter},
                                  context_instance=RequestContext(request))
def editReporter(request, reporter_pk):
    reporter = get_object_or_404(Contact, pk=reporter_pk)
    reporter_form = EditReporterForm(instance=reporter)
    if request.method == 'POST':
        reporter_form = EditReporterForm(instance=reporter,
                                         data=request.POST)
        if reporter_form.is_valid():
            reporter_form.save()
        else:
            return render_to_response('ureport/partials/contacts/edit_reporter.html',
                    {'reporter_form': reporter_form, 'reporter': reporter},
                                      context_instance=RequestContext(request))
        return render_to_response('ureport/partials/contacts/contacts_row.html',
                        {'object': Contact.objects.get(pk=reporter_pk),
                        'selectable': True},
                                  context_instance=RequestContext(request))
    else:
        return render_to_response('ureport/partials/contacts/edit_reporter.html'
            , {'reporter_form': reporter_form,
               'reporter': reporter},
                                  context_instance=RequestContext(request))
def editReporter(request, reporter_pk):
    reporter = get_object_or_404(Contact, pk=reporter_pk)
    reporter_form = EditReporterForm(instance=reporter)
    if request.method == "POST":
        reporter_form = EditReporterForm(instance=reporter, data=request.POST)
        if reporter_form.is_valid():
            reporter_form.save()
        else:
            return render_to_response(
                "ureport/partials/contacts/edit_reporter.html",
                {"reporter_form": reporter_form, "reporter": reporter},
                context_instance=RequestContext(request),
            )
        return render_to_response(
            "/ureport/partials/contacts/contacts_row.html",
            {"object": Contact.objects.get(pk=reporter_pk), "selectable": True},
            context_instance=RequestContext(request),
        )
    else:
        return render_to_response(
            "ureport/partials/contacts/edit_reporter.html",
            {"reporter_form": reporter_form, "reporter": reporter},
            context_instance=RequestContext(request),
        )