I'm trying to fill in the value of a foreign key entry in one of my models using a value stored as session data...it all works well but when I try to access the record from the admin I get this error:
Caught an exception while rendering: coercing to Unicode:
need string or buffer, Applicant found
Where Applicant
is the model linked to by the foreign key field. How am I supposed to sort out this issue? The code is as follows:
if "customer_details" in request.session:
customer = request.session["customer_details"]
else:
return HttpResponseRedirect('/application/')
if request.method == 'POST':
current_address_form = CurAddressForm(request.POST or None)
if current_address_form.is_valid():
current = current_address_form.save(commit=False)
current.customer = customer
current.save()
else:
current_address_form = CurAddressForm()
return render_to_response('customeraddress.html', {
'current_address_form': current_address_form,},
context_instance=RequestContext(request))