[Django] #27073: Checks framework doesn't ignore overridden model managers

48 views
Skip to first unread message

Django

unread,
Aug 16, 2016, 9:03:41 PM8/16/16
to django-...@googlegroups.com
#27073: Checks framework doesn't ignore overridden model managers
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 1.10
layer (models, ORM) |
Severity: Release | Keywords:
blocker |
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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'.`

{{{ #!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.

Django

unread,
Aug 17, 2016, 12:29:41 AM8/17/16
to django-...@googlegroups.com
#27073: Checks framework doesn't ignore overridden model managers
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Django

unread,
Aug 17, 2016, 3:06:47 AM8/17/16
to django-...@googlegroups.com
#27073: Checks framework doesn't ignore overridden model managers
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Django

unread,
Aug 17, 2016, 3:41:03 AM8/17/16
to django-...@googlegroups.com
#27073: Checks framework doesn't ignore overridden model managers
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Django

unread,
Aug 18, 2016, 12:40:20 PM8/18/16
to django-...@googlegroups.com
#27073: Checks framework doesn't ignore overridden model managers
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by loic):

PR https://github.com/django/django/pull/7115.

--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:4>

Django

unread,
Aug 18, 2016, 1:59:45 PM8/18/16
to django-...@googlegroups.com
#27073: Overridden model managers shouldn't appear in _meta.managers

-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:5>

Django

unread,
Aug 18, 2016, 2:25:02 PM8/18/16
to django-...@googlegroups.com
#27073: Overridden model managers shouldn't appear in _meta.managers
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* 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>

Django

unread,
Aug 18, 2016, 2:28:41 PM8/18/16
to django-...@googlegroups.com
#27073: Overridden model managers shouldn't appear in _meta.managers
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Django

unread,
Nov 5, 2016, 12:15:32 PM11/5/16
to django-...@googlegroups.com
#27073: Overridden model managers shouldn't appear in _meta.managers
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: nobody

Type: Bug | Status: closed
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Rief):

* cc: jacob.rief@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/27073#comment:8>

Reply all
Reply to author
Forward
0 new messages