Using peewee to create a table with a foreign key will report mysql 1452 error

database = MySQLDatabase('test1', user='root', host='x.x.x.x', port=3306, passwd='xxxx')

class BaseModel(Model):
    class Meta:
        database = database

class Users(BaseModel):
    name = CharField(max_length=32, null=False)
    email = CharField(max_length=64, null=True)
    phone = CharField(max_length=11, null=False)
    password = CharField(max_length=32 ,null=False)

class Groups(BaseModel):
    name = CharField(max_length=32, unique=True, null=False)

class User_group(BaseModel):
    user_id = ForeignKeyField(Users,backref='user_groups')
    group_id = ForeignKeyField(Groups,backref='user_groups')

def create_user():
    user = Users.create(name="test",email="test@g.com",phone="13142134252",password="test")
    group = Groups.create(name="test")
    User_group.create(uesr_id=user,group_id=group)

I created a user table and a group table through peewee, and then there is a many-to-many association table user_group, I created a user test and a group test through the function create_user. I want to add a field to the user_group table. I followed the official website method. Why would I get an error?

Traceback (most recent call last):
  File "E:\OWG_devops\venv\lib\site-packages\django\core\handlers\exception.py", line 35, in inner
    response = get_response(request)
  File "E:\OWG_devops\venv\lib\site-packages\django\core\handlers\base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "E:\OWG_devops\venv\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "E:\OWG_devops\venv\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "E:\OWG_devops\venv\lib\site-packages\django\views\generic\base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "E:\OWG_devops\venv\lib\site-packages\rest_framework\views.py", line 505, in dispatch
    response = self.handle_exception(exc)
  File "E:\OWG_devops\venv\lib\site-packages\rest_framework\views.py", line 465, in handle_exception
    self.raise_uncaught_exception(exc)
  File "E:\OWG_devops\venv\lib\site-packages\rest_framework\views.py", line 476, in raise_uncaught_exception
    raise exc
  File "E:\OWG_devops\venv\lib\site-packages\rest_framework\views.py", line 502, in dispatch
    response = handler(request, *args, **kwargs)
  File "E:\OWG_devops\OWG_devops\OWGDevops\app\views.py", line 113, in post
    create_user(serializer.data, user.get("groups"))
  File "E:\OWG_devops\OWG_devops\OWGDevops\auth\Operation.py", line 6, in create_user
    User_group.create(uesr_id=user,group_id=group)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 6346, in create
    inst.save(force_insert=True)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 6556, in save
    pk = self.insert(**field_dict).execute()
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 1907, in inner
    return method(self, database, *args, **kwargs)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 1978, in execute
    return self._execute(database)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 2745, in _execute
    return super(Insert, self)._execute(database)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 2474, in _execute
    cursor = database.execute(self)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 3157, in execute
    return self.execute_sql(sql, params, commit=commit)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 3151, in execute_sql
    self.commit()
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 2917, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 190, in reraise
    raise value.with_traceback(tb)
  File "E:\OWG_devops\venv\lib\site-packages\peewee.py", line 3144, in execute_sql
    cursor.execute(sql, params or ())
  File "E:\OWG_devops\venv\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
    res = self._query(query)
  File "E:\OWG_devops\venv\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
    db.query(q)
  File "E:\OWG_devops\venv\lib\site-packages\MySQLdb\connections.py", line 259, in query
    _mysql.connection.query(self, query)
peewee.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`test1`.`user_group`, CONSTRAINT `user_group_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)')

I suspect that there is any problem with my mysql, so I execute the insert command under the command line. But found that it can be inserted successfully

enter image description here

Can you give me some help, thanks in advance