It's not possible to use `six.with_metaclass` to subclass `models.Model` with a custom metaclass.
|Reported by:||charettes||Owned by:||charettes|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If those apps are ever ported to support PY2 and PY3 in the same code base using six they will have to use six.with_metaclass to achieve it.
Unfortunately, models.base.BaseModel.__new__ chokes when a model is defined this way:
from django.db import models from django.utils import six class CustomBaseModel(models.base.BaseModel): pass class CustomModel(six.with_metaclass(CustomBaseModel, models.Model)): pass
because the 'NewBase' checks don't take into account this case.
Change History (8)
comment:1 Changed 3 years ago by charettes
- Needs documentation unset
- Needs tests unset
- Owner changed from nobody to charettes
- Patch needs improvement unset
- Status changed from new to assigned
Changed 3 years ago by charettes
comment:4 Changed 3 years ago by Aymeric Augustin <aymeric.augustin@…>
- Resolution set to fixed
- Status changed from assigned to closed