"<Message: title>" needs to have a value for field "id" before this many-to-many relationship can be used.
Django documentation: https://docs.djangoproject.com/en/1.11/topics/db/examples/many_to_many/
Check code after
What follows are examples of operations that can be performed using the Python API facilities. Note that if you are using an intermediate model for a many-to-many relationship, some of the related manager’s methods are disabled, so some of these examples won’t work with such models.
My must save parent model first, and only after that you can add m2m values. Check below
receive_user = User.objects.get(id=user_id)
message = Message.objects.create(
title=title,
content=content,
create_user=create_user,
# receive_user=receive_user,
)
# message.save() - no needs in save() when you use create() method
message.receive_user.add(receive_user)