I’m doing a single inheritance subclass for a django admin class like so:
from django.contrib.auth import admin as auth_admin
class UserAdmin(auth_admin.UserAdmin):
pass
And I’m getting the error: “metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases”
I think I understand what the error is complaining about – but I’m not clear on why I’m getting it with only a single ancestor. Every other time I’ve seen this error, it’s because I’m using multiple inheritance. What could the single ancestor’s class metaclass be conflicting with?
The issue turned out to be unrelated to the actual admin class – The form used for add_form must be a subclass of ModelForm – in this case it was just a plain Form. When added to the page django introspects the form and attempts to inject a class in if it’s not a ModelForm, leading the to the metatype mismatch.