ge...@aquarianhouse.com wrote:
> You Welcome.
> 
> I guess is the combination between POST nad instance data.
> 
> did you try only:
> 
> form = ActionForm(request.POST)
> 
> because in POST is already the data posted.
> 
> you might have like this before the form:
> 
> def view_name(request):
>     form = ActionForm()
> 
>     if request.method == 'POST':
>         form = ActionForm(request.POST)
> 
>     #....
> 
>    return render_to_response('tmp.html', locals())#etc...

This is the code in my update view:

def action_edit(request, action_id):
    action = get_object_or_404(Action, pk=action_id)
    if request.method == 'POST':
        form = ActionForm(request.POST, action)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse(call_detail, kwargs={"call_id": 
action.call.id})) # Redirect after POST
    form=ActionForm(instance=action)
    return render_to_response('management/action_edit.html', {'form': form, 
context_instance=RequestContext(request))

I get an IntegrityError when saving:

IntegrityError at /management/action/edit/1/

null value in column "call_id" violates not-null constraint

Regards,
Benedict

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to