summaryrefslogtreecommitdiff
path: root/docs/orms.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/orms.rst')
-rw-r--r--docs/orms.rst15
1 files changed, 15 insertions, 0 deletions
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`