Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Apr 27, 2015
  1. Fix typo.

  2. Allow skipping Mongo tests.

Commits on Apr 25, 2015
  1. Clarify .build() issue with Django>1.8 (Ref #198).

    From 1.8 onwards, this crashes:
    >>> a = MyModel()  # Don't save
    >>> b = MyOtherModel(fkey_to_mymodel=a)
    In turn, it breaks:
        class MyModelFactory(factory.django.DjangoModelFactory):
            class Meta:
                model = MyModel
        class MyOtherModelFactory(factory.django.DjangoModelFactory):
            class Meta:
                model = MyOtherModel
            fkey_to_mymodel = factory.SubFactory(MyModelFactory)
     # Breaks
    The error message is: Cannot assign "MyModel()": "MyModel" instance isn't saved in the database.
    See for details.
Commits on Apr 13, 2015
  1. Remove warnings with Django 1.7 (Closes #195).

    Builds upon pull request by @shinuza:
    - Properly import ``get_model``
    - Run ``django.setup()`` before importing any models.
Commits on Apr 12, 2015
  1. test_mongoengine: fix typo

  2. mongoengine: allow tuning the server timeout.

    So that it doesn't fail on ci...
  3. Fix tests with latest pymongo/mongoengine.

    mongoengine>=0.9.0 and pymongo>=2.1 require extra parameters:
    - The server connection timeout was set too high
    - We have to define a ``read_preference``.
Commits on Apr 2, 2015
  1. Fix imports for Django 1.8

Commits on Mar 27, 2015
  1. Support declarations in FileField/ImageField.

    Previously, the declarations (``factory.Sequence`` & co)  weren't properly computed.
  2. Respect default manager in DjangoModelFactory (Closes #192).

    The previous version tries to use ``cls._default_manager`` all the time,
    which breaks with ``manager.using(db_name)``.
Commits on Mar 26, 2015
  1. Update header years.

  2. Turn FileField/ImageField into normal fields (Closes #141).

    Previously, they ran as post_generation hooks, meaning that they
    couldn't be checked in a model's ``save()`` method, for instance.
  3. Remove limitations of factory.StubFactory (Closes #131).

    ```` is now supported, and maps to
  4. Add support for multidb with Django (Closes #171).

    The ``factory.django.DjangoModelFactory`` now takes an extra option:
    class MyFactory(factory.django.DjangoModelFactory):
        class Meta:
            model = models.MyModel
            database = 'replica'
    This will create all instances of ``models.Model`` in the ``'replica'``
  5. Fix issues between mute_signals() and factory inheritance (Closes #183).

    Previously, if a factory was decorated with ``@mute_signals`` and one of
    its descendant called another one of its descendant, signals weren't
    unmuted properly.
  6. Allow lazy evaluation of FuzzyChoice's iterators (Closes #184).

    This allows the following idiom:
    ``user = factory.fuzzy.FuzzyChoice(User.objects.all())``
    Previously, the ``User.objects.all()`` queryset would have been
    evaluated *at import time*; it is now evaluated with the first use of the
Commits on Feb 18, 2015
  1. Enable resetting factory.fuzzy's random generator (Closes #175, #185).

    Users may now call ``factory.fuzzy.get_random_state()`` to retrieve
    the current random generator's state (isolated from the one used in
    Python's ``random``).
    That state can then be reinjected with
Commits on Nov 17, 2014
  1. Remove deprecated features.

    This disables the ``FACTORY_FOR`` syntax and related parameters,
    that should be declared through ``class Meta``.
Commits on Nov 16, 2014
  1. Remove automagic pk-based sequence setup

    Related to issues #78, #92, #103, #111, #153, #170
    The default value of all sequences is now 0; the automagic
    ``_setup_next_sequence`` behavior of Django/SQLAlchemy has been removed.
    This feature's only goal was to allow the following scenario:
    1. Run a Python script that uses MyFactory.create() a couple of times
       (with a unique field based on the sequence counter)
    2. Run the same Python script a second time
    Without the magical ``_setup_next_sequence``, the Sequence counter would be set
    to 0 at the beginning of each script run, so both runs would generate objects
    with the same values for the unique field ; thus conflicting and crashing.
    The above behavior having only a very limited use and bringing various
    issues (hitting the database on ``build()``, problems with non-integer
    or composite primary key columns, ...), it has been removed.
    It could still be emulated through custom ``_setup_next_sequence``
    methods, or by calling ``MyFactory.reset_sequence()``.
Commits on Nov 2, 2014
Commits on Sep 3, 2014
  1. Fix support for Django 1.7.

Commits on Aug 21, 2014
Commits on Jun 23, 2014
  1. Fix declaration inheritance.

Commits on Jun 21, 2014
Commits on May 18, 2014
  1. Fix test_deprecation test.

  2. Rename 'target' to 'model'.

  3. Remove containers.DeclarationsDict.

    Now replaced with a simple dict.
  4. Switch tests to class Meta.

  5. Add tests for class Meta

Something went wrong with that request. Please try again.