Re: Newforms best practice

2007-04-06 Thread John M
I use a very similar design, except instead of instanceform = myform(instance=instance) I use instanceform = form_for_Instance(instance) I'm not sure what the difference is, they should both return a valid Form that creates the necessary information, but I had issues like yourself for that too

Newforms best practice

2007-04-05 Thread tyman26
>def add_edit_model(request, id=None): > if id is not None: >instance = MyModel.objects.get(id=id) >InstanceForm = MyForm(instance=instance) >else: >InstanceForm = MyForm() >if request.POST: >form = InstanceForm(request.POST) >if form.is_valid():