I am using the ParsePy
from https://github.com/dgrtwo/ParsePy to access our Parse DB (it works really easy, almost out of the box for me, btw).
The problem I have is that want to get joined data from two classes.
We have a UserVote
class that is linked to the User class.
According to the example I see that I can use the select_related
to get the attributes of User as well as those of UserVote.
The question is how would I access the attributes of the related object?
Specifically User has an attribute named username
and I can't find it also under vote
or under vote.user
anywhere.
I am running the following code:
allvotes = UserVote.Query.all().select_related("User")
for vote in allvotes:
if hasattr(vote, 'username') or hasattr(vote, 'user') and hasattr(vote.user, 'username'):
print vote
In the debugger I do see that I get votes, and that there is an attribute vote.user
but I find no vote that holds a username as I expected.
I get no output for the above code.