Recently I have been developing an app using Django ninja. I want to add Group to user groups, and statement seems have no effect. It does not commit to db. I tried atomic, and all solutions but it does not work. I have db for tests:
settings.DATABASES["default"] = {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
"ATOMIC_REQUESTS": False,
"TIME_ZONE": "America/Chicago",
"CONN_HEALTH_CHECKS": True,
"CONN_MAX_AGE": 0,
"OPTIONS": {},
"AUTOCOMMIT": True
}
This is code:
group = await cls.repository.get_group_by_name(name)
assert group
await user.groups.aadd(group)
In Django documentation this should work just fine, but it does not. I use AsyncClient from Django to run tests.
Any advice ?