From 3a5709527d362a960a1a35769375412e4536839e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Sun, 18 May 2014 15:10:56 +0200 Subject: Rename 'target' to 'model'. --- docs/reference.rst | 106 ++++++++++++++++++++++++++--------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'docs/reference.rst') diff --git a/docs/reference.rst b/docs/reference.rst index f19b44e..d616d1c 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -23,10 +23,10 @@ The :class:`Factory` class class MyFactory(factory.Factory): class Meta: - target = MyObject + model = MyObject abstract = False - .. attribute:: target + .. attribute:: model This optional attribute describes the class of objects to generate. @@ -40,10 +40,10 @@ The :class:`Factory` class be used to generate objects, but instead provides some extra defaults. It will be automatically set to ``True`` if neither the :class:`Factory` - subclass nor its parents define the :attr:`~FactoryOptions.target` attribute. + subclass nor its parents define the :attr:`~FactoryOptions.model` attribute. .. warning:: This flag is reset to ``False`` When a :class:`Factory` subclasses - another one if a :attr:`~FactoryOptions.target` is set. + another one if a :attr:`~FactoryOptions.model` is set. .. versionadded:: 2.4.0 @@ -57,7 +57,7 @@ The :class:`Factory` class class UserFactory(factory.Factory): class Meta: - target = User + model = User arg_parameters = ('login', 'email') login = 'john' @@ -76,7 +76,7 @@ The :class:`Factory` class While writing a :class:`Factory` for some object, it may be useful to have general fields helping defining others, but that should not be - passed to the target class; for instance, a field named 'now' that would + passed to the model class; for instance, a field named 'now' that would hold a reference time used by other objects. Factory fields whose name are listed in :attr:`hidden_args` will @@ -87,7 +87,7 @@ The :class:`Factory` class class OrderFactory(factory.Factory): class Meta: - target = Order + model = Order hidden_args = ('now',) now = factory.LazyAttribute(lambda o: datetime.datetime.utcnow()) @@ -115,7 +115,7 @@ The :class:`Factory` class .. attribute:: FACTORY_FOR .. deprecated:: 2.4.0 - See :attr:`FactoryOptions.target`. + See :attr:`FactoryOptions.model`. .. attribute:: ABSTRACT_FACTORY @@ -258,19 +258,19 @@ The :class:`Factory` class Subclasses may fetch the next free ID from the database, for instance. - .. classmethod:: _build(cls, target_class, *args, **kwargs) + .. classmethod:: _build(cls, model_class, *args, **kwargs) .. OHAI_VIM* This class method is called whenever a new instance needs to be built. - It receives the target class (provided to :attr:`~FactoryOptions.target`), and + It receives the model class (provided to :attr:`~FactoryOptions.model`), and the positional and keyword arguments to use for the class once all has been computed. Subclasses may override this for custom APIs. - .. classmethod:: _create(cls, target_class, *args, **kwargs) + .. classmethod:: _create(cls, model_class, *args, **kwargs) .. OHAI_VIM* @@ -286,8 +286,8 @@ The :class:`Factory` class class Meta: abstract = True # Optional - def _create(cls, target_class, *args, **kwargs): - obj = target_class(*args, **kwargs) + def _create(cls, model_class, *args, **kwargs): + obj = model_class(*args, **kwargs) obj.save() return obj @@ -363,7 +363,7 @@ factory_boy supports two main strategies for generating instances, plus stubs. but not persisted to any datastore. It is usually a simple call to the :meth:`~object.__init__` method of the - :attr:`~FactoryOptions.target` class. + :attr:`~FactoryOptions.model` class. .. data:: CREATE_STRATEGY @@ -386,7 +386,7 @@ factory_boy supports two main strategies for generating instances, plus stubs. when using the ``create`` strategy. That policy will be used if the - :attr:`associated class ` has an ``objects`` + :attr:`associated class