def render_manual_detention_step_two(request, target): """Controller for rendering interface choices when manualy detaining""" error = "" candidates = find_id_information(target, 3, trunk_ok=True) camtuple_choices = [(x.camid, humanize(x)) for x in candidates] if request.method == 'POST': form = ManualDetentionForm(request.POST) form.fields['camtuple'].choices = camtuple_choices if form.is_valid(): error = process_manual_detention_form(form, get_account(request)) if not error: return redirect('arnold-detainedports') else: form = ManualDetentionForm(initial={'target': target}) return render_to_response('arnold/manualdetain-step2.html', create_context('Manual detention', { 'active': {'manualdetention': True}, 'target': target, 'candidates': candidates, 'form': form, 'now': datetime.now(), 'error': error }), RequestContext(request))