Opened 8 years ago
Last modified 11 months ago
#27080 new New feature
`as_manager` on QuerySet should pass down `use_in_migrations` to new Manager instance
Reported by: | Leif Denby | Owned by: | |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Ülgen Sarıkavak | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | |||
Description ¶
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.
According to the ticket's flags, the next step(s) to move this issue forward are:
- To add tests to the patch, then uncheck the "Needs tests" flag on the ticket.
- To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (6)
comment:1 by , 8 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I have a tested fix for this, about to submit a PR if such a change is still welcome.
comment:3 by , 6 years ago
Component: | Database layer (models, ORM) → Migrations |
---|---|
Type: | Bug → New feature |
Version: | 1.10 → master |
comment:4 by , 6 years ago
Patch needs improvement: | set |
---|
PR still needs to test migration serialization of querysets or queryset generated managers.
comment:5 by , 18 months ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:6 by , 11 months ago
Cc: | added |
---|
The PR needs a test.