mirror of
https://github.com/django/django.git
synced 2025-07-27 07:03:55 +00:00
add comment to explain why it's necessary to do an explicit check for
Python2 and how metaclasses are defined
This commit is contained in:
parent
c70ca4879e
commit
5124ab7620
1 changed files with 3 additions and 1 deletions
|
@ -16,6 +16,8 @@ class CustomBaseModel(models.base.ModelBase):
|
||||||
class MyModel(six.with_metaclass(CustomBaseModel, models.Model)):
|
class MyModel(six.with_metaclass(CustomBaseModel, models.Model)):
|
||||||
"""Model subclass with a custom base using six.with_metaclass."""
|
"""Model subclass with a custom base using six.with_metaclass."""
|
||||||
|
|
||||||
|
# This is done to ensure that for Python2 only, defining metaclasses
|
||||||
|
# still does not fail to create the model.
|
||||||
|
|
||||||
if not six.PY3:
|
if not six.PY3:
|
||||||
class MyModel(models.Model):
|
class MyModel(models.Model):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue