aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-09-25 10:58:12 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-09-25 10:58:12 +0200
commit2e5046bda818771f474a1514465f71bd62be9dcd (patch)
treeade9d0c6f02fbc4dfbe066b41c6765c215a68f81 /docs
parentea00fa30273c7355c02a361c1193ea4764528edb (diff)
downloadfactory-boy-2e5046bda818771f474a1514465f71bd62be9dcd.tar
factory-boy-2e5046bda818771f474a1514465f71bd62be9dcd.tar.gz
Fix Django sequences with abstract base models.
Diffstat (limited to 'docs')
-rw-r--r--docs/changelog.rst11
-rw-r--r--docs/orms.rst15
2 files changed, 26 insertions, 0 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 3e07a82..e5fe303 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,6 +1,17 @@
ChangeLog
=========
+
+.. _v2.2.1:
+
+2.2.1 (2013-09-24)
+------------------
+
+*Bugfix:*
+
+ - Fixed sequence counter for :class:`~factory.django.DjangoModelFactory` when a factory
+ inherits from another factory relating to an abstract model.
+
.. _v2.2.0:
2.2.0 (2013-09-24)
diff --git a/docs/orms.rst b/docs/orms.rst
index a463bfb..33b3e0a 100644
--- a/docs/orms.rst
+++ b/docs/orms.rst
@@ -74,6 +74,21 @@ All factories for a Django :class:`~django.db.models.Model` should use the
[<User: john>, <User: jack>]
+.. note:: If a :class:`DjangoModelFactory` relates to an :obj:`~django.db.models.Options.abstract`
+ model, be sure to declare the :class:`DjangoModelFactory` as abstract:
+
+ .. code-block:: python
+
+ class MyAbstractModelFactory(factory.django.DjangoModelFactory):
+ FACTORY_FOR = models.MyAbstractModel
+ ABSTRACT_FACTORY = True
+
+ class MyConcreteModelFactory(MyAbstractModel):
+ FACTORY_FOR = models.MyConcreteModel
+
+ Otherwise, factory_boy will try to get the 'next PK' counter from the abstract model.
+
+
.. class:: FileField
Custom declarations for :class:`django.db.models.FileField`