#35898: Cannot use base managers of related models in dumpdata command
-------------------------------------+-------------------------------------
Reporter: Lorenzo Martini | Owner: (none)
Type: New feature | Status: closed
Component: Core | Version: 5.1
(Serialization) |
Severity: Normal | Resolution: wontfix
Keywords: dumpdata chunk_size | Triage Stage:
iterator prefetch_related user | Unreviewed
base_manager default_manager |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* resolution: => wontfix
* status: new => closed
* summary: dumpdata Command Fails on Model with Custom User Manager =>
Cannot use base managers of related models in dumpdata command
* type: Bug => New feature
Comment:
Hi Lorenzo
I don't think this is a bug but a new feature potentially. I think the
issue can be roughly demonstrated like:
{{{
class CustomManager(models.Manager):
use_in_migrations = False
def get_queryset(self):
# This will fail!
return super().get_queryset().filter(author="Roald Dahl")
class CustomManagerModel(models.Model):
objects = CustomManager()
class NewModel(models.Model):
customs = models.ManyToManyField('CustomManagerModel',
related_name='new', blank=True)
}}}
Then you run `dumpdata` for `NewModel` with the `--all` flag
(https://docs.djangoproject.com/en/5.1/ref/django-admin/#cmdoption-
dumpdata-all) but this means you use the base manager for that model, not
all related models
I think this use case is quite niche but feel free to propose it on the
[https://forum.djangoproject.com/c/internals/5 Forum] and see if others
agree this should be supported
--
Ticket URL: <https://code.djangoproject.com/ticket/35898#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701930b78bfcc-b5658013-4900-49a0-911b-c7fa53043e3a-000000%40eu-central-1.amazonses.com.