﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16646	Only first meta inner class inherited with multiple abstract base models.	John Shimek	nobody	"Code shows this better:

app.models.py
{{{
from django.db import models

class FirstMixin(models.Model):
    name = models.CharField(max_length=100)

    class Meta:
        abstract = True

class SecondMixin(models.Model):
    order = models.PositiveIntegerField()

    class Meta:
        abstract = True
        ordering = ['order']

class Concrete(FirstMixin, SecondMixin):
    published = models.BooleanField()
}}}

Ordering is set on the Concrete instances:
{{{
>>> from red.models import Concrete
>>> c = Concrete()
>>> c._meta.ordering
[]
}}}

If instead concrete is defined with 

{{{
class Concrete(SecondMixin, FirstMixin):
    published = models.BooleanField()
}}}

Notice that SecondMixin is the first class that Concrete subclasses instead of FirstMixin. This results in 

{{{
>>> c = Concrete()
>>> c._meta.ordering
['order']
}}}

It is very unintuitive and in my opinion incorrect. The order of which classes to inherit from shouldn't prevent inheriting the Meta inner class as well. This could cause hard to find bugs, such as why 'ordering' is not correct or why two different concrete classes have different meta settings while having the same parent classes.

The other way to address this is like so:

{{{
class Concrete(FirstMixin, SecondMixin):
    published = models.BooleanField()
    
    class Meta(SecondMixin.Meta):
        pass
}}}

This is more explicit, but would a developer think this has to be done until they ran into this issue? Also, I think this is the only way to possibly get Meta options from multiple parent classes by having class Meta(SecondMixin.Meta, FirstMixin.Meta).
"	Bug	closed	Database layer (models, ORM)	1.3	Normal	invalid			Unreviewed	0	0	0	0	0	0
