On Thu, 2009-07-30 at 23:42 -0700, Asinox wrote:
> Thanks Malcom for replay, but, is not working for me, i think that is
> simple just .filter("field1__field2"), but i cant make the join i try
> with .filter("field1__field2") where the field1 is the PK and the
> field2 is the FK.
> 
> here is my query:
> 
> p = Diligencia.objects.filter(Q(socio=request.user.id),Q(status=0) | Q
> (status=1)| Q(status=3)).filter("id__diligencia")
> 
> and the error is: too many values to unpack

It's effectively impossible to debug this from the information you've
provided, because we cannot see the model(s) you are trying to query
against. I am, however, very suspicious of the bit that says
filter("id__diligencia"), since "id" is almost always the auto-generated
primary key field and not a reference to another model.

Please construct some simple models that show the problem you're seeing.
Also, the error isn't just reported as you say above. It also has a
traceback in there, which is typically very useful, as it shows us where
the error is coming from.

> 
> im new with Django i cant understand this error, i searched and i cant
> find answer about it.
> 
> The another try was:
> 
> p = Diligencia.objects.filter(Q(socio=request.user.id),Q(status=0) | Q
> (status=1)| Q(status=3)).select_related()
> 
> in this case i dont have errors but the data that i want to show from
> the second table is not showing... and Django dont have any setting
> function that will show the "SQL" that is happening in any query,

You can try this approach, which shows the SQL after the query has been
run:

http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running

Or look at the output of p.query.as_sql() (where "p" is your queryset,
above) to see the results of the SQL that would be sent to the database.
Or look at django-debug-toolbar for a more in-browser view of thigns.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to