I'm trying to associate Character objects with a custom model by means of a ForeignKey field on the custom model, but there doesn't seem to be a functional way to actually pass the Character model to the ForeignKey field. My understanding is that typeclasses are glorified proxy models, so this should work...
If you give FK a string model reference to the Character model, Django doesn't like the 3-deep nested structure.
char = models.ForeignKey(settings.BASE_CHARACTER_TYPECLASS, on_delete=models.CASCADE, ... )
yields
ValueError: Invalid model reference 'typeclasses.characters.Character'. String model references must be of the form 'app_label.ModelName'.
If you give FK 'typeclasses.Character' as the string model reference, it (rightfully) doesn't work because the model doesn't exist at that path.
If you try to give FK the model itself, Evennia doesn't appear to have loaded the typeclass model yet at the time the custom model is loaded.
char = models.ForeignKey(Character, on_delete=models.CASCADE, ... )
...
class Character(DefaultCharacter):
TypeError: Error when calling the metaclass bases
cannot create 'NoneType' instance.
So far the workaround I've come up with is just giving the ForeignKey field ObjectDB as the model, but this is not ideal.
Is there a better way of going about this?
Thanks!