This is my first introduction to ‘Long’ Objects, and I haven’t found much in the Django docs on Querysets & long objects. I am trying to join two different queries into a list which I can email each user.
Two questions – is this the proper way to join these queries? If so, how do I access the profile.user.email attribute without hitting this long object error?
email_list = []
for user in request.user.get_profile().followers.all():
email_list.append(user)
for profile in Profile.objects.filter(city=request.user.get_profile().city.id):
if not profile.user.id in email_list:
print type(profile.user.id)
email_list.append(profile.user.id)
Error:
AttributeError: 'long' object has no attribute 'email'
You are adding to the list ‘long’ objects (they are just numbers) instead of actual User instances:
it should be: