[Django]-Why can't I access class Meta as a attribute of Django Model Class?

41👍

The Meta attribute is changed by metaclass.

Try:

SomeDjangoModel._meta
👤Don

4👍

A Meta attribute defined on a class is a bespoke pattern for associating and containing additional data that is going to be introspected by the class’ metaclass upon type creation.

You can review the ModelBase metaclass and see how it uses the Meta attribute to configure the resulting model class that’s being constructed.

Leave a comment