diff options
author | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2011-12-12 16:24:26 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2011-12-12 16:24:26 +0100 |
commit | d90d41a06e763067d80b5fdaf890d9b829c959c5 (patch) | |
tree | 0053ebc754d89f2c40768406cd48a26fa2458295 | |
parent | 41c68349cf3925818a6c05477790a2f67d431d39 (diff) | |
download | factory-boy-d90d41a06e763067d80b5fdaf890d9b829c959c5.tar factory-boy-d90d41a06e763067d80b5fdaf890d9b829c959c5.tar.gz |
Django models always have a _default_manager attribute; .objects may not be a manager.
-rw-r--r-- | factory/base.py | 2 |
1 files changed, 1 insertions, 1 deletions
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 |