`CustomArticle.on_site: (sites.E001) CurrentSiteManager could not find a
field named 'sites'.`
{{{ #!python
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/27073>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by loic):
I'm not sure I get it. The `CustomArticle` doesn't seem to have a `site`
field, so why shouldn't the warning be raised?
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:1>
Comment (by adamchainz):
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?
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:2>
Comment (by loic):
OK got it, I missed the `site_for_article` part. I've got a fix in mind.
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:3>
Comment (by loic):
PR https://github.com/django/django/pull/7115.
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:4>
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"d4eefc7e2af0d93283ed1c03e0af0a482982b6f0" d4eefc7e]:
{{{
#!CommitTicketReference repository=""
revision="d4eefc7e2af0d93283ed1c03e0af0a482982b6f0"
Fixed #27073 -- Removed duplicated managers in `Model._meta.managers`.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:6>
Comment (by Loïc Bistuer <loic.bistuer@…>):
In [changeset:"21f18e5372fe86090a82b696f3208e56c6a2aa80" 21f18e53]:
{{{
#!CommitTicketReference repository=""
revision="21f18e5372fe86090a82b696f3208e56c6a2aa80"
[1.10.x] Fixed #27073 -- Removed duplicated managers in
`Model._meta.managers`.
Backport of d4eefc7e2af0d93283ed1c03e0af0a482982b6f0 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:7>
* cc: jacob.rief@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:8>