How to bulk_update queryset values

            # Count mandate for each delegate, multiply it by score
            delegate_votes = PollVotingTypeRanking.objects.filter(author_delegate__poll=poll).values('pk').annotate(
                score=F('priority') *
                Count('author_delegate__created_by__groupuserdelegator',
                      filter=~Q(author_delegate__created_by__groupuserdelegator__delegator__pollvoting__poll=poll) &
                      Q(author_delegate__created_by__groupuserdelegator__tags__in=[poll.tag])))

            # Set score to the same as priority for user votes
            user_votes = PollVotingTypeRanking.objects.filter(author__poll=poll
                                                              ).values('pk').annotate(score=F('priority'))

            PollVotingTypeRanking.objects.bulk_update(delegate_votes | user_votes, fields=('score',))

Attempting to update the values for delegate_votes and user_votes, how do i do that? Currently im getting the error 'dict' object has no attribute pk

Back to Top