#27073 closed Bug (fixed)
Overridden model managers shouldn't appear in _meta.managers
Reported by: | Tim Graham | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.10 |
Severity: | Release blocker | Keywords: | |
Cc: | Loic Bistuer, jacob.rief@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The following models from the Django test suite validate on Django 1.9.x but result in this error on Django 1.10:
CustomArticle.on_site: (sites.E001) CurrentSiteManager could not find a field named 'sites'.
from django.contrib.sites.managers import CurrentSiteManager from django.contrib.sites.models import Site from django.db import models class AbstractArticle(models.Model): on_site = CurrentSiteManager() class Meta: abstract = True class CustomArticle(AbstractArticle): site_for_article = models.ForeignKey(Site, models.CASCADE) on_site = CurrentSiteManager('site_for_article')
Bisected to 3a47d42fa33012b2156bf04058d933df6b3082d2. CustomArticle._meta.managers
shows both CurrentSiteManager
instances and the one from the abstract model raises the error.
Change History (8)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Perhaps the real mistake is running check()
for the shadowed CurrentSiteManager
from the abstract model? It's not accessible from the concrete model once it's been shadowed right?
comment:5 by , 8 years ago
Has patch: | set |
---|---|
Summary: | Checks framework doesn't ignore overridden model managers → Overridden model managers shouldn't appear in _meta.managers |
Triage Stage: | Accepted → Ready for checkin |
comment:8 by , 8 years ago
Cc: | added |
---|
I'm not sure I get it. The
CustomArticle
doesn't seem to have asite
field, so why shouldn't the warning be raised?