Hi all,
How can I force the ChangeManipulator so that  the form fields will
contain the current values of the object when editing?

I have the model:
###################
class User(meta.Model):
      Login=meta.CharField(maxlength=50,unique=True)
      Password=meta.CharField(maxlength=30)
      Email=meta.EmailField(_('e-mail address'))
      RealName=  meta.CharField(maxlength=70)
      Company= meta.CharField(maxlength=70,blank=True)
      Address=  meta.CharField( maxlength=200,blank=True)
      DateOfJoined=meta.DateTimeField(auto_now_add=True)
      Phone= meta.CharField( maxlength=25,blank=True)
      Fax= meta.CharField(maxlength=25,blank=True)
      Notes=meta.TextField(blank=True)
###################

and for this model I have the view
#####################
def Test(request):
        try:
                manipulator = users.ChangeManipulator(1)
        except users.UserDoesNotExist:
                raise Http404
        user = manipulator.original_object
        if request.POST:
                new_data = request.POST.copy()
                errors = manipulator.get_validation_errors(new_data)
                if not errors:
                        manipulator.do_html2python(new_data)
                        new_user = manipulator.save(new_data)
                        return render_to_response('board/UserWasCreated', 
{'new_user':
new_user,"FindUserFromSessionID":FindUserFromSessionID})
        else:
                errors = new_data= {}
                new_data = user.__dict__
        form = formfields.FormWrapper(manipulator, new_data, errors)
        return render_to_response('board/TestCreateUserForm', {'form': form})
##############

where the template TestCreateUserForm  looks like this
###############
<h1>Change your profile1</h1>
<form method="post" action="./">
  <table border="0" cellpadding="3" cellspacing="5" width="105%">
    <tr>
      <td width="22%"><big><font color="#0000FF"><label
for="id_Login">Login:</label>&nbsp; </font></big></td>
      <td width="3%"><big><strong><font
color="#FF0000">*</font></strong></big></td>
      <td width="81%" colspan="2"><font color="#00FF00"><input
type="text" id="id_Login"
      class="vTextField required" name="{{Login}}" size="30" value
maxlength="50" /></font></td>
    </tr>
  </table>
  <p><span class="required"><big><font
color="#FF0000">*</font></big></span> Required
  information</p>
  <p>&nbsp; </p>
  <p><input type="submit"  value="Register"/> </p>
</form>
#################
When I try the Test view,  the template TestCreateUserForm   is open
but without any value.But why without the value(s)??

Thank you for help.
Regards,
Lad.

Reply via email to