Sunday, March 31, 2013

(1242, 'Subquery returns more than 1 row')

I have the following error in my project

(1242, 'Subquery returns more than 1 row')

my views are as given below

def result_cube(request):
Id = Cube.objects.aggregate(Max('Report_id'))
ID = Id['Report_id__max']
cubee = Cube.objects.filter(Report_id = ID)
Id = Report.objects.aggregate(Max('id'))
ID = Id['id__max']
Head = Report.objects.filter(id = ID)
organisation = Organisation.objects.all().filter(id = 1)
department = Department.objects.all().filter(id = 1)

Id = Report.objects.aggregate(Max('job'))
ID = Id['job__max']
job = Report.objects.filter(job = ID)

client =
Job.objects.all().filter(client=job).values('client__client__first_name',
'client__client__middle_name', 'client__client__last_name',
'client__client__address', 'client__client__city', 'date',
'letter_no', 'letter_date')

temp = {'client':client, 'cubee':cubee, 'Head':Head,
'organisation':organisation,'department':department,}
return render_to_response('report/cube.html',
dict(temp.items() + tmp.items()),
context_instance=RequestContext(request))


Error during template rendering

In template /home/satinder/Automation/templates/report/header.html,
error at line 12

2 {% load i18n %}
3 <html>
4 {% block content %}
5 <body>
6 {% for Heads in Head %}
7 <table width="100%"><tr>
8 <td align="left"><a>No.GNDEC/TCC/R/{{Heads.job_id}}</td><td
align="right"><a>Dated{{Heads.dispatch_report_date}}</a></td>
9 </tr></table>
10 <!-- <p><b>Job no:</b><a style="padding-left:30px;
position:absolute">{{Heads.job_no}}</a></p>
11 --> <p>To,</p>
12 {% for add in client %}
13 <p> {{ add.client__client__first_name}} {{
add.client__client__middle_name}}
{{add.client__client__last_name}}</p>
14 <p> {{add.client__client__address}}</p>
15 <p>{{ add.client__client__city}}</p>
16 {% endfor %}
17

Can anybody help me to solve this error.


--
Satinderpal Singh
http://devplace.in/~satinder/wordpress/
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

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

No comments:

Post a Comment