From d90d41a06e763067d80b5fdaf890d9b829c959c5 Mon Sep 17 00:00:00 2001 From: Raphaƫl Barrois Date: Mon, 12 Dec 2011 16:24:26 +0100 Subject: Django models always have a _default_manager attribute; .objects may not be a manager. --- factory/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'factory') diff --git a/factory/base.py b/factory/base.py index 890a7c9..f25fd5c 100644 --- a/factory/base.py +++ b/factory/base.py @@ -268,6 +268,6 @@ class DjangoModelFactory(Factory): @classmethod def _setup_next_sequence(cls): try: - return cls._associated_class.objects.values_list('id', flat=True).order_by('-id')[0] + 1 + return cls._associated_class._default_manager.values_list('id', flat=True).order_by('-id')[0] + 1 except IndexError: return 1 -- cgit v1.2.3