[Django] #27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new Manager instance

13 views
Skip to first unread message

Django

unread,
Aug 17, 2016, 8:23:50 PM8/17/16
to django-...@googlegroups.com
#27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new
Manager instance
----------------------------------------------+--------------------
Reporter: leifdenby | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
When using the convenience method `as_manager` on a QuerySet the attribute
`is_in_migrations`
(https://docs.djangoproject.com/en/1.9/topics/migrations/#model-managers)
is currently not passed down. This means that when creating a migration
the `Manager`s which a created from `QuerySet`s won't be serialised into
the migration. The current workaround would be to create Manager class
from the QuerySet, thereby using the old approach where
`QuerySet.as_manager` isn't used.

--
Ticket URL: <https://code.djangoproject.com/ticket/27080>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 17, 2016, 8:39:04 PM8/17/16
to django-...@googlegroups.com
#27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new
Manager instance
-------------------------------------+-------------------------------------

Reporter: leifdenby | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 1
* stage: Unreviewed => Accepted


Comment:

The [https://github.com/django/django/pull/7110 PR] needs a test.

--
Ticket URL: <https://code.djangoproject.com/ticket/27080#comment:1>

Django

unread,
Nov 18, 2018, 2:22:26 PM11/18/18
to django-...@googlegroups.com
#27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new
Manager instance
-------------------------------------+-------------------------------------
Reporter: Leif Denby | Owner: Oliver
| Newman
Type: Bug | Status: assigned

Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Oliver Newman):

* status: new => assigned
* owner: nobody => Oliver Newman


Comment:

I have a tested fix for this, about to submit a PR if such a change is
still welcome.

--
Ticket URL: <https://code.djangoproject.com/ticket/27080#comment:2>

Django

unread,
Nov 19, 2018, 11:45:32 AM11/19/18
to django-...@googlegroups.com
#27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new
Manager instance
-----------------------------+-----------------------------------------

Reporter: Leif Denby | Owner: Oliver Newman
Type: New feature | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+-----------------------------------------
Changes (by Oliver Newman):

* type: Bug => New feature
* version: 1.10 => master
* component: Database layer (models, ORM) => Migrations


--
Ticket URL: <https://code.djangoproject.com/ticket/27080#comment:3>

Django

unread,
Dec 27, 2018, 11:53:25 AM12/27/18
to django-...@googlegroups.com
#27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new
Manager instance
-----------------------------+-----------------------------------------
Reporter: Leif Denby | Owner: Oliver Newman
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-----------------------------+-----------------------------------------
Changes (by Simon Charette):

* needs_better_patch: 0 => 1


Comment:

PR still needs to test migration serialization of querysets or queryset
generated managers.

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

Django

unread,
Aug 23, 2023, 7:54:38 AM8/23/23
to django-...@googlegroups.com
#27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new
Manager instance
-----------------------------+------------------------------------
Reporter: Leif Denby | Owner: (none)
Type: New feature | Status: new
Component: Migrations | Version: dev

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* owner: Oliver Newman => (none)
* status: assigned => new


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

Django

unread,
Mar 12, 2024, 2:43:31 AMMar 12
to django-...@googlegroups.com
#27080: `as_manager` on QuerySet should pass down `use_in_migrations` to new
Manager instance
-----------------------------+------------------------------------
Reporter: Leif Denby | Owner: (none)
Type: New feature | Status: new
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/27080#comment:6>
Reply all
Reply to author
Forward
0 new messages