On Sat, 2007-06-09 at 14:38 +0000, Car wrote: > Thanks for your answer > > Now I have following snippet: > http://dpaste.com/11938/ > > But, is at a good practice to create Model objects in a view ? Where > code of that kind of operations should be placed?
Why not create it there? That is the moment you have all the data you need and all you're doing is calling a constructor. The code you've written there is a pretty normal pattern for taking form information and putting it into a model. By the way, you might want to investigate form_for_model() (see the newforms documentation again) if you are taking all your form data and putting it into one model. That would mean you would create the form and then form.save() will push all the form fields into the model and save them. It's another possibility, not compulsory by any means (and I strongly encourage anybody who first learns to do forms manually, in any case -- you won't later be worried about having to go back to this method to do anything complex). Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

