Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Uses factory_boy to supply test data factory classes for all stock Django models.

Project Description

When testing a django app, a common case is to create some data, then test app behavior around that test data. This is usually done with fixtures, but this includes some pain.

factory_boy is useful for concisely creating objects, particularly for test data.

This project will supply factory_boy classes for each model Django ships. The factories are named after the class it constructs. For example, a factory for django.contrib.auth.models.User is available at django_factory_boy.auth.UserFactory.

See factory_boy for detailed docs, but all fields are given default values which can be overriden by passing keyword arguments to the constructor. For example:

from django_factory_boy import auth as auth_factories
user = auth_factories.UserFactory(first_name="test")

would result in a saved User instance whose first_name is set to "test".

The resulting objects are normal django model instances, so once they are constructed you can use them in the normal ways.

Not all django models have been added yet; if you need one, open an issue or a pull request. Currently supported:

  • contrib.auth (UserFactory, GroupFactory, PermissionFactory)
  • contrib.sites (SiteFactory)

This project intends to support all Python versions which Django does - 2.6 - 3.4 as of Django 1.6. It supports all Django versions from 1.6 onwards.

Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_factory_boy-1.0.0-py2.py3-none-any.whl (4.8 kB) Copy SHA256 Checksum SHA256 3.3 Wheel Oct 20, 2015
django-factory_boy-1.0.0.tar.gz (3.3 kB) Copy SHA256 Checksum SHA256 Source Oct 20, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting