Well, first I should correct myself on MariaDB...we use 10.5, not 11.5, so not the latest version (and in fact quite old).
Some research on this suggests that this error is usually due to bad SQL syntax. The error means something in your SQL is trying to set a foreign key to an invalid value of 0. MySQL doesn't (or isn't supposed to) let FKs pointed to automatic primary key (auto increment) fields be 0...the reference would be invalid since automatic fields in MySQL start at 1 and are always a positive integer. If there's no correct value for a foreign key, it should be null , not 0.
Whether the 0 being fed into that function is the result of Django doing something weird, being broken/different version, or you just have bad code is beyond my knowledge.