How about this instead?

The view code:
==========
def profile_edit_info(request, user_id):
  try:
    manipulator = users.ChangeManipulator(user_id)
  except users.UserDoesNotExist:
    raise Http404

  if request.POST:
    # flatten existing data to strings
    new_data = manipulator.flatten_data()
    new_data['first_name'] = request.POST['first_name']
    new_data['last_name'] = request.POST['last_name']
    new_data['email'] = request.POST['email']
    errors = manipulator.get_validation_errors(new_data)
    manipulator.do_html2python(new_data)

    if not errors:
      new_user = manipulator.save(new_data)

      return HttpResponseRedirect('/cms/')
  else:
    # No POST, so we want a brand new form without any data or errors.
    errors = {}
    new_data = manipulator.flatten_data()

  # Create the FormWrapper, template, context, response.
  form = formfields.FormWrapper(manipulator, new_data, errors)
  return render_to_response('cms/profile_edit_info', {'form': form},
    Context(request))

=====

Sorry about the line noise.

Kieran

Reply via email to