Opened 8 years ago

Last modified 8 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

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 Managers which a created from QuerySets 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.

Change History (6)

comment:1 by Tim Graham, 8 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

The PR needs a test.

comment:2 by Oliver Newman, 6 years ago

Owner: changed from nobody to Oliver Newman
Status: newassigned

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

comment:3 by Oliver Newman, 6 years ago

Component: Database layer (models, ORM)Migrations
Type: BugNew feature
Version: 1.10master

comment:4 by Simon Charette, 6 years ago

Patch needs improvement: set

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

comment:5 by Mariusz Felisiak, 15 months ago

Owner: Oliver Newman removed
Status: assignednew

comment:6 by Ülgen Sarıkavak, 8 months ago

Cc: Ülgen Sarıkavak added
Note: See TracTickets for help on using tickets.
Back to Top