Essentially, it seems that my data is being pulled from the db, but I receive the addresses instead of the strings themselves. What I am trying to get from the db is a list of 3 friends for a profile page, (stringproperties).
This is my db class:
class Friends(db.Model):
name = db.StringProperty(required = True)
friend = db.StringProperty()
added_date = db.DateTimeProperty(auto_now_add = True)
My profile handler:
class Profile(MainHandler):
def get(self, profile_id):
if self.user and profile_id:
current_user = self.user.name
name1 = ''
friend_name = ''
team_imagee = ''
key = ''
imgs = db.GqlQuery("select * from Profile_Images WHERE name =:1", profile_id)
team_name = db.GqlQuery("select * from Teams WHERE name =:1", profile_id)
team_images = db.GqlQuery("select * from Teamimg WHERE user =:1", profile_id)
friends = db.GqlQuery("select * from Friends WHERE name =:1 order by added_date desc limit 10", profile_id)
for clan in team_name:
name1 = clan.team_name_anycase
for image in team_images:
team_imagee = image.key()
for img in imgs:
key = img.key()
self.render('profile.html', profile_id = profile_id, current_user = current_user, friends = friends, team_img = team_imagee, team_name = name1, profile_image = key, username = self.user.name, email = self.user.email, firstname = self.user.first_name, last_name = self.user.last_name, country = self.user.country)
else:
self.redirect('/register')
And the for loop in my template:
{% for friend in friends %}
{{friend}}
<br>
{% endfor %}
Would anyone be so kind as to tell me why I sometimes see these addresses instead of the objects themselves, (even just in general).
In your view, you are returning the
db.GqlQuery("..")query object that is an iterator and you are actually printing the default object string representation of each entity returned by the query.I guess you should have to iterate and access the
friendproperty like this: