I'd need to see the source for Job and that other model, plus a proper exception traceback, so I can tell at what point the IntegrityError is being thrown.
also, you should not be using form.save() there... if you do a commit=False to get a copy of the model, you only need to save that model... re-saving the form again is probably an error. On Monday, December 17, 2012 10:55:00 PM UTC-8, sandy wrote: > > On Tue, Dec 18, 2012 at 2:48 AM, Satinderpal Singh > <satinder...@gmail.com <javascript:>> wrote: > > I created a search box for searching the information about the client > > so that this information uses to create the report. > > add these lines : > > > def search(request): > <snip> > > {% endfor %} > > > > i want to get job id to be saved through header view: > > def header(request): > job =Job.objects.get(id=request.GET['q']) > > if request.method=='POST': > > form = headForm(request.POST) > > if form.is_valid(): > > cd = form.cleaned_data > profile = form.save(commit=False) > profile.job = job > profile.save() > form.save() > > HttpResponseRedirect(reverse('Automation.report.views.result')) > > > > But get the following error: > > IntegrityError at /report/header/ > > (1048, "Column 'job_id' cannot be null") > > > > Please anybody tell me where i am wrong? > > > Hope this helps you. > > -- > Sandeep Kaur > E-Mail: mkaur...@gmail.com <javascript:> > Blog: sandymadaan.wordpress.com > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/OhGhVvo7EP4J. To post to this group, send email to django-users@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.