dj3fb can generate DjangoModelFactory for your django models by using factory_boy.
Project description
dj3fb
English | 简体中文
dj3fb can generate DjangoModelFactory for your django models by using factory_boy.
1. Introduction
dj3fdis a Django app that has a commandgenerate_factories, which can generateDjangoModelFactoryclasses based on Django models.- There is a variable
finfaker_utils, which is an instance ofFakerand 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dj3fb-0.3.0.tar.gz
(9.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
dj3fb-0.3.0-py3-none-any.whl
(10.3 kB
view details)
File details
Details for the file dj3fb-0.3.0.tar.gz.
File metadata
- Download URL: dj3fb-0.3.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e78ce0867c2f8dee26e7bce5de80283f2897aee66ac3c4e7ee4cb08af2c1081
|
|
| MD5 |
40aa3a2d925c795a2f8ff2ff09694476
|
|
| BLAKE2b-256 |
55dd42533a1dea40c767ea8e00fc1f3743bfb1b0803a8f489a1cd4a448d2a4c0
|
File details
Details for the file dj3fb-0.3.0-py3-none-any.whl.
File metadata
- Download URL: dj3fb-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a816e59a207dce6df75f03f04e0a67ad3e88464f30b92a369a4888a5c4de367
|
|
| MD5 |
19f2ebc562c936e70fdb407e7997a6ed
|
|
| BLAKE2b-256 |
d3e9a60e54dcec56a4769b6d8475386c2bfa5d48ed8b9f3d8764c6bc43dbb667
|