Skip to main content

dj3fb

English | 简体中文

dj3fb can generate DjangoModelFactory for your django models by using factory_boy.

1. Introduction

  • dj3fd is a Django app that has a command generate_factories, which can generate DjangoModelFactory classes based on Django models.
  • There is a variable f in faker_utils, which is an instance of Faker and can be used to generate random data.

2. Usage

Install

pip install dj3fb

Examples

  • Configure settings.py
INSTALLED_APPS = [
    '...',
    'dj3fb',
    '...'
]

# Optional.
DJ3FB = {
    # Optional.Generate factory classes for django built-in apps or third-party apps.
    "include_third_party_apps": [
        "django.contrib.admin",
        "django.contrib.auth",
        "django.contrib.contenttypes",
        "django.contrib.sessions",
        "django.contrib.messages",
        "django.contrib.staticfiles",
    ],
    # Optional.Manually specify a factory class for a model instead of generating it automatically.
    "existed_factories": {
        "django.contrib.auth.User": "test_app.UserFactory"
    },
}
  • Execute the command: generate_factories
python manage.py generate_factories
# In the app directory, a factories directory will be generated, which contains factory classes generated based on the models.

Metadata

Release files for dj3fb 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj3fb 0.3.0
File Size Uploaded
dj3fb-0.3.0.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dj3fb 0.3.0
File Interpreter ABI Platform
dj3fb-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / dj3fb-0.3.0.tar.gz

Download URL dj3fb-0.3.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2e78ce0867c2f8dee26e7bce5de80283f2897aee66ac3c4e7ee4cb08af2c1081
BLAKE2b-256 checksum
How to use checksums
55dd42533a1dea40c767ea8e00fc1f3743bfb1b0803a8f489a1cd4a448d2a4c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release files / dj3fb-0.3.0-py3-none-any.whl

Download URL dj3fb-0.3.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a816e59a207dce6df75f03f04e0a67ad3e88464f30b92a369a4888a5c4de367
BLAKE2b-256 checksum
How to use checksums
d3e9a60e54dcec56a4769b6d8475386c2bfa5d48ed8b9f3d8764c6bc43dbb667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page