﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6155	Dumpdata Fails If There Is No Objects Attribute When Using a Custom Manager	empty	nobody	"Dumpdata fails if there is no objects default manager when Including your own custom manager.  For example if we have a model that looks like:

{{{
class CategoryManager(models.Manager):
    def find_django(self):
        return self.filter(name='Django').order_by('name',)

class Category(models.Model):
    name = models.CharField(max_length=50)
    user = models.ManyToManyField(User)
    
    active_objects = CategoryManager()
}}}

Since there is no objects attribute on the model when the following dumpdata code runs it will fail with an attribute error:

{{{
        objects = []
        for app in app_list:
            for model in get_models(app):
                objects.extend(model.objects.all())
}}}

See [http://groups.google.com/group/django-users/browse_thread/thread/7a58d619aea92d9c] for more information.

The fix is to modify the block so it looks like this:

{{{
        objects = []
        for app in app_list:
            for model in get_models(app):
                objects.extend(model._default_manager.all())
}}}
"		closed	Core (Other)	dev		fixed	dumpdata		Unreviewed	1	0	0	0	0	0
