Since form_for_model isn't nearly finished yet (regarding with
FileFields and customization - or I just can't find how it works), I
have decided to just repeat myself and create my own forms.

I thought that it'd be very intuitive if a form instance gets bound to
the data from a model instance, but it seems it doesn't. To clarify
things:

def MyForm(newforms.Form):
  field1=newforms.CharField()
  field2=newforms.CharField()


def MyModel(models.Model):
  field1=models.TextField()
  field2=models.TextField()


m = MyModel.objects.get(pk=1)
f = MyForm(f) # this should pre-populate the form with the data from
the model, but it doesn't.
#In fact, nothing even gets displayed on the screen...

Am I assuming something wrong ? I'd love to use form_for_model, but
I'm using compound models (it's a user profile, really) and it's not
very useful, as I'll still have to customize it extensively.

Or should I just display more than one form on a page ? Meaning:

def myview(request):
  form1 = MyForm1(request.POST) # some fields are here
  form2 = MyForm2(request.POST) # some other fields are here
  #save the forms.

The user will see just one form, but it'll be split behind the scenes
to map to different Forms and Models...

Do I make sense ?

Thanks :)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to