I have 2 models
I use this models to show the avatar in comments.
django_comments:
user_id
comment
.....
myapp_profile
user_id
image_path
......
Actually i´m doing a raw query with cursor.execute(), to get this data
------- ---------- -------
'user_id' 'image_path' 'comment'
------- ---------- -------
3 name.jpg test
but i want to do in “django orm ways”
Any solution?
Thanks
Think about this: What will you get back? That wouldn’t be an instance of either model, would it?
However, with the newer annotate() and F() features, you might be able to pull off something like:
Of course, you could always just:
and get image_path from x.user.get_profile().image_path