On Tue, Dec 18, 2012 at 11:21 AM, Chris Cogdon <ch...@cogdon.org> wrote: > Can you post the code for the model, and the complete exception trace?
class head(models.Model): job = models.ForeignKey(Job, null=True) Header_column_1 = models.CharField(max_length=255,blank=True) Header_column_2 = models.CharField(max_length=255,blank=True) Footer_column_3 = models.CharField(max_length=255,blank=True) def __str__(self): return self.refrence_no > > On Monday, December 17, 2012 1:18:54 PM UTC-8, Satinderpal Singh wrote: >> >> I created a search box for searching the information about the client >> so that this information uses to create the report. >> def search(request): >> query = request.GET.get('q', '') >> if query: >> results = Job.objects.filter(id = >> >> query).values('client__client__name','client__client__address_1','clientjob__material__name','suspencejob__field__name','id','job_no','date','site','report_type',) >> else: >> results = [] >> return render_to_response("report/search.html", {"results": >> results,"query": query}) >> >> I want to save the value of job in the report table to create a report >> like: >> {% for job in results %} >> <li>Job Id : {{ job.id }}</li> >> <li>Name:{{job.client__client__name}}</li> >> <li>Job No. : {{job.job_no}}</li> >> <li>Site : {{job.site}}</li> >> <li>Reference Letter No : {{job.Reference_Letter_no}}</li> >> <li>Letter Date : {{job.Letter_date}}</li> >> <li>Address : {{job.client__client__address_1}}</li> >> <li>Material : {{job.clientjob__material__name}}</li> >> <b><a href="{{ LOCAL_URL }}/automation/report/header/?id={{ >> job.id }}">Report</a></b> >> {% endfor %} >> >> i want to get job id to be saved through header view: >> def header(request): >> if request.method=='POST': >> form = headForm(request.POST) >> if form.is_valid(): >> cd = form.cleaned_data >> form.save() >> return >> 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? >> >> >> >> >> -- >> Satinderpal Singh >> http://satindergoraya.blogspot.in/ >> http://satindergoraya91.blogspot.in/ > > -- > 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/-/8St7erk3yrAJ. > 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. -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.