summaryrefslogtreecommitdiff
path: root/factory
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-06-10 01:19:36 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-06-10 01:26:32 +0200
commit83461f0ff1772f7d29936c11fa6ecf49c22ef1d8 (patch)
treed96daf29c1bb535ee30be0d8f98030b288e0e5f9 /factory
parent85dde20cf2e337a4e0b7de47d067edfaf2e633ab (diff)
downloadfactory-boy-83461f0ff1772f7d29936c11fa6ecf49c22ef1d8.tar
factory-boy-83461f0ff1772f7d29936c11fa6ecf49c22ef1d8.tar.gz
Add django-based tests for DjangoModelFactory.
Diffstat (limited to 'factory')
-rw-r--r--factory/django.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/factory/django.py b/factory/django.py
index 351cb76..3eabca1 100644
--- a/factory/django.py
+++ b/factory/django.py
@@ -59,7 +59,9 @@ class DjangoModelFactory(base.Factory):
try:
return 1 + manager.values_list('pk', flat=True
).order_by('-pk')[0]
- except IndexError:
+ except (IndexError, TypeError):
+ # IndexError: No instance exist yet
+ # TypeError: pk isn't an integer type
return 1
@classmethod