dumpdata command is also affected
Hello,
the dumpdata command does not work with scopes. So I disabled scopes for this command.
from django.core.management.commands.dumpdata import Command as DumpdataCommand
from django_scopes import scopes_disabled
class Command(DumpdataCommand):
def handle(self, *args, **options):
with scopes_disabled():
return super().handle(*args, **options)
maybe it can be included?
I'm not sure if overriding a default Django manage command in an installed app is a great idea, as it would interfere with other apps doing the same thing. Maybe we should instead include your solution in the docs instead?
Describing in docs would be good. But I think that, when the package django-scopes breaks this command, it should patch it. Other commands are also affected like datamigrations and shell - like the docs mention, but they work generally, it depend from usage how much the effects are. dumpdata is simply broken.
I'm not sure if overriding a default Django manage command in an installed app is a great idea
Channels does it with runserver, so there's at least precedent ;) But I'm also not a fan. A more general solution could be recommending something like a manage_unscoped.py?
Is there a workaround to scope the "dumpdata" command? `python manage.py dumpdata master.endnode
[CommandError: Unable to serialize database: A scope on dimension(s) org needs to be active for this query.`
Yes, the workaround is in the original description of this issue :)