[Fixed]-A django model that subclasses an abc, gives a metaclass conflict

2👍

Apart from creating a new metaclass that inherits from both ABCMeta and ModelBase, or making ABCMeta inherit from ModelBase, there isn’t much you can do.

However, possibly a different registration pattern might be appropriate? Maybe something like contrib.admin.autodiscover? Or a class decorator? Or a loop at the bottom of the .py file which calls register on the appropriate classes (ex, for var in globals().values(): if isinstance(var, type) and issubclass(var, AbastractBase): register(var))?

Edit: D’oh. I’d assumed that ABCMeta was an example, not ABCMeta. That’s what I get for browsing StackOverflow on too little sleep.

Leave a comment