What's your motive? Are you worried about performance?
If performance is not an issue, you can just do this:
for project in Project.objects.all():
print project.user.first_name + ' ' + project.user.last_namea
This might speed things up:
projects = Project.objects.all().select_related('user')
for project in projects:
print project.user.first_name + ' ' + project.user.last_namea
If that's not fast enough, you may want to do something using .extra()
or .raw(). I'm not sure how to do this effeciently with .extra().
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.