Ticket #7566: 6155.diff

File 6155.diff, 1.5 KB (added by Karen Tracey <kmtracey@…>, 7 years ago)

Patch that updates doc as well

  • django/core/management/commands/dumpdata.py

     
    1616    args = '[appname ...]'
    1717
    1818    def handle(self, *app_labels, **options):
    19         from django.db.models import get_app, get_apps, get_models
     19        from django.db.models import get_app, get_apps, get_models, query
    2020
    2121        format = options.get('format','json')
    2222        indent = options.get('indent',None)
     
    4343        objects = []
    4444        for app in app_list:
    4545            for model in get_models(app):
    46                 objects.extend(model._default_manager.all())
     46                objects.extend(query.QuerySet(model).all())
    4747        try:
    4848            return serializers.serialize(format, objects, indent=indent)
    4949        except Exception, e:
  • docs/django-admin.txt

     
    157157
    158158The output of ``dumpdata`` can be used as input for ``loaddata``.
    159159
    160 Note that ``dumpdata`` uses the default manager on the model for selecting the
    161 records to dump. If you're using a `custom manager`_ as the default manager
    162 and it filters some of the available records, not all of the objects will be
    163 dumped.
    164 
    165 .. _custom manager: ../model-api/#custom-managers
    166 
    167160--exclude
    168161~~~~~~~~~
    169162
Back to Top