Question

I understand Meta can be inherited if the superclass has abstract=True, but can't be inherited otherwise. Is this because Django somehow consumes and removes the Meta class from concrete classes? I'd like to do something as in the example below, so Derived can get the Meta properties from Base (in this case, to inherit permissions as part of django-guardian).

Suggestions on how to achieve this would be appreciated.

Ian

class Base(Model):
    class Meta:
        permissions = (("foo", "Allowed to do foo"),)

class Derived(Base):
    class Meta(Base.Meta): pass

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top