that don't work. The query can find the "User" fields. On 6 oct, 05:43, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Oct 6, 2:44 am, refreegrata <refreegr...@yahoo.com> wrote: > > > > > Hello list. I'm have a questio. if I have an "inner join" query an use > > an "only" restriction, how can i put a field of the second table in > > the "only" tuple? > > > Example: > > > Model > > --------- > > class Abc(models.Model): > > fk_user = models.ForeignKey(User, related_name='user_pp') > > fk_ee = models.ForeignKey(Dd, related_name='dd_dd') > > ccc = models.BooleanField(default=False) > > > And my query > > > User.objects.filter(user_pp__fk_departamento='aa'].id).only('username') > > > But i want to do something like > > > User.objects.filter(user_pp__fk_departamento='aa'].id).only('username', > > 'ccc') > > or > > User.objects.filter(user_pp__fk_departamento='aa'].id).only('username', > > 'user_pp__ccc') > > but that's don't work. How i can put the ccc field inside the 'only' > > tuple. > > > Thanks for read,a and sorry for my poor english. > > Try it the other way round - starting from Abc. > > Abc.objects.filter(fk_departamento='aa').only('fk_user__username', > 'ccc') > -- > DR.
-- 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.