I have a Django app where users post photos and others post comments on photos.
When a comment is left, I need to notify:
- Everyone else who wrote in this thread
- The owner of the photo, if they are not included in (1)
For (1):
#I slice by 25 because I arbitrarily deem anyone beyond that irrelevant. all_commenter_ids = PhotoComment.objects.filter(which_photo=which_photo).order_by('-id').values_list('submitted_by', flat=True)[:25]
Next, for (2) I try:
all_relevant_ids = all_commenter_ids.append(which_photo.owner_id) all_relevant_ids = list(set(all_relevant_ids))
As a result, I get an error message:
'ValuesListQuerySet' object does not have 'append' attribute
I find this strange because I am retrieving values_list .
Isn't that a list object, in which case the append attribute should not work in this scenario? Please explain what is wrong and suggest alternatives.
source share