I have a problem loading a migration fixture with GM2M-data. It seems to come down to gm2m.helpers.GM2MModelMetaclass. Basically, gm2m.helpers.GM2MModel tries to metaclass gm2m.helpers.Dummy, and then override that:
GM2MModel.__bases__ = (models.Model,)
That is supposed to bypass the Django machinery, but that does not work on my setup, using Django 2.2 and python 3.6 or 3.7. Instead Django will do its thing, and while doing post_init it tries to do a lookup using the GM2MModelMetaclass, which fails with a TypeError: unhashable type.
I solved the problem locally by adding a hash method to GM2MModelMetaclass. That works for the migration of data, but I don't understand the mechanisms enough to propose that as a general solution.
I have a problem loading a migration fixture with GM2M-data. It seems to come down to gm2m.helpers.GM2MModelMetaclass. Basically, gm2m.helpers.GM2MModel tries to metaclass gm2m.helpers.Dummy, and then override that:
GM2MModel.__bases__ = (models.Model,)
That is supposed to bypass the Django machinery, but that does not work on my setup, using Django 2.2 and python 3.6 or 3.7. Instead Django will do its thing, and while doing post_init it tries to do a lookup using the GM2MModelMetaclass, which fails with a TypeError: unhashable type.
I solved the problem locally by adding a hash method to GM2MModelMetaclass. That works for the migration of data, but I don't understand the mechanisms enough to propose that as a general solution.
def __hash__(cls): return hash(RECURSIVE_RELATIONSHIP_CONSTANT)