3

I have a model that inherit from 2 abstract models with attributes in their meta-classes.

How can I make it inherit the metas from both parent classes? It seems like it only inherit the meta of the class written first.

1 Answer 1

6

Normal rules for Python's multiple inheritance apply when using it in Django. That means that if multiple parents have the Meta class, only the Meta of the first parent will be used. Others will be ignored.

See this URL for more info https://docs.djangoproject.com/en/dev/topics/db/models/#multiple-inheritance

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.