(django 1.2) Hi, i need to do the following: Class 1, with a field called "field1" (CharField) Class 2, with a field called "fieldwfk" (ForeignKey)
User enters a text and submits, which goes into "searchtext" --- searchtext = request.GET.get('text') Now i want to get all Class2 objects WHERE fieldwfk CONTAINS searchtext. With the following code: --- class1s = Class1.objects.filter(field1__icontains=searchtext) --- cl2 = Class2.objects.filter(fieldwfk__id=clienteric).order_by('-id') or even with the following code: --- class1s = Class1.objects.get(field1__icontains=searchtext) --- cl2 = Class2.objects.filter(fieldwfk__id=class1s.id).order_by('-id') I get what i want, but... only if class1s matches only 1 record... otherwise i get --- Caught OperationalError while rendering: (1242, 'Subquery returns more than 1 row') in the first case and --- get() returned more than one Clienti -- it returned 3! Lookup parameters were {'nomecliente__icontains': u'ca'} in the second. Plz help me... T_T -- 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.