Proxy models do not inherit META.app_label
|Reported by:||gsong||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Normal||Keywords:||proxy model app_label|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
According to the proxy model documentation:
"Proxy models inherit any Meta options that they don't define from their non-abstract model parent (the model they are proxying for)."
In the case of app_label, this is not true.
from django.db import models class Book(models.Model): name = models.CharField(max_length=50) class Meta: app_label = 'core' class Book1(Book): class Meta: proxy = True >>> from django.db import models >>> for model in models.get_models(): print model._meta ... core.book proxy.book1
Change History (4)
comment:1 Changed 5 years ago by Alex
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted