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
>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():
2 matches
Mail list logo