2013-02-25 07:09:13 +08:00
|
|
|
from django.db import models
|
2013-01-29 13:28:09 +08:00
|
|
|
|
2013-02-25 07:09:13 +08:00
|
|
|
# The models definitions below used to crash. Generating models dynamically
|
2013-12-24 19:25:17 +08:00
|
|
|
# at runtime is a bad idea because it pollutes the app registry. This doesn't
|
2013-02-25 07:09:13 +08:00
|
|
|
# integrate well with the test suite but at least it prevents regressions.
|
|
|
|
|
|
|
|
|
|
|
|
class CustomBaseModel(models.base.ModelBase):
|
2013-01-29 13:28:09 +08:00
|
|
|
pass
|
2013-02-25 07:09:13 +08:00
|
|
|
|
|
|
|
|
2017-01-07 19:11:46 +08:00
|
|
|
class MyModel(models.Model, metaclass=CustomBaseModel):
|
|
|
|
"""Model subclass with a custom base using metaclass."""
|