tests/base/models.py
raw| 1 | from django.db import models |
| 2 | |
| 3 | # The models definitions below used to crash. Generating models dynamically |
| 4 | # at runtime is a bad idea because it pollutes the app registry. This doesn't |
| 5 | # integrate well with the test suite but at least it prevents regressions. |
| 6 | |
| 7 | |
| 8 | class CustomBaseModel(models.base.ModelBase): |
| 9 | pass |
| 10 | |
| 11 | |
| 12 | class MyModel(models.Model, metaclass=CustomBaseModel): |
| 13 | """Model subclass with a custom base using metaclass.""" |