Problem with adding objects to manytomany fields

I have a User model:

class User(AbstractUser):
    followers_num = models.IntegerField(default=0)
    followings_num = models.IntegerField(default=0)
    followers = models.ManyToManyField('self', null=True, blank=True)
    followings = models.ManyToManyField('self', null=True, blank=True)

And there’s a view for adding/removing user objects from followers/followings:

def follow(request, follow, user):
    if (request.method == 'PUT'):
        following_user = User.objects.get(username=user)
        follower_user = User.objects.get(username=request.user.username)
        if follow:
            # Follow
            following_user.followers.add(follower_user)
            following_user.followers_num += 1

            follower_user.followings.add(following_user)
            follower_user.followings_num += 1
        else:
            # Unfollow
            following_user.followers.remove(follower_user)
            following_user.followers_num -= 1

            follower_user.followings.remove(following_user)
            follower_user.followings_num -= 1
        
        following_user.save()
        follower_user.save()
        return HttpResponse(status=204)

I want it to add follower_user to the followers of following_user and add following_user to the followings of follower_user. However, instead of doing so, it adds follower_user not only to the followers of following_user, but it also adds it to the followings of following_user. Why does it happen?

This model structure seems “wrong” to me. Why do you have two different self-related ManyToMany fields?

It’s a bad data design to manually track a number of entries easily determined by a count function - I would remove those fields.

A ManyToMany relationship is a two-way relationship. By general definition, if Person A follows Person B, then you can just as validly say that Person B is followed by Person A. You don’t need a separate relationship between the two.

Also, it makes no sense to provide for a null or blank value in a ManyToMany field.

I would suggest you fix your model before worrying about the views that need to work with it.