this is my code.
# Lista de usuarios
UserList = []
UserDic = {}
UserListQuery = UserProfile.objects.all()
print "PRINTING QUERY " + UserListQuery
for User in range(0,len(UserListQuery)):
UserDic['username'] = UserListQuery[User].user.get_username()
UserDic['titulo'] = UserListQuery[User].titulo
UserDic['descripcion'] = UserListQuery[User].descripcion[:60]
UserList.append(UserDic)
print "PRINTING LIST " + UserList
print "PRINTING LIST 0 " + UserList[0]
I want UserList to be a dict list. I mean, if I print UserList[0]['username'], it has to return me the username in the position 0. Well, I've many users. I use append and I'm adding the user to the list. It's not working well, it overwrites the user resulting in a one position list, the last user from UserListQuery.
help?