model-bakery 1.20.2__tar.gz → 1.20.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of model-bakery might be problematic. Click here for more details.
- {model_bakery-1.20.2 → model_bakery-1.20.3}/PKG-INFO +1 -1
- model_bakery-1.20.3/model_bakery/__about__.py +1 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/baker.py +8 -4
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/recipe.py +3 -0
- model_bakery-1.20.2/model_bakery/__about__.py +0 -1
- {model_bakery-1.20.2 → model_bakery-1.20.3}/.gitignore +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/LICENSE +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/README.md +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/__init__.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/_types.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/content_types.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/exceptions.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/generators.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/gis.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/mock_file.txt +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/mock_img.jpeg +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/py.typed +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/random_gen.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/timezone.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/model_bakery/utils.py +0 -0
- {model_bakery-1.20.2 → model_bakery-1.20.3}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: model-bakery
|
|
3
|
-
Version: 1.20.
|
|
3
|
+
Version: 1.20.3
|
|
4
4
|
Summary: Smart object creation facility for Django.
|
|
5
5
|
Project-URL: Homepage, https://github.com/model-bakers/model_bakery
|
|
6
6
|
Author-email: berin <bernardoxhc@gmail.com>, amureki <amureki@hey.com>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.20.3"
|
|
@@ -70,6 +70,10 @@ def _valid_quantity(quantity: Optional[Union[str, int]]) -> bool:
|
|
|
70
70
|
return quantity is not None and (not isinstance(quantity, int) or quantity < 1)
|
|
71
71
|
|
|
72
72
|
|
|
73
|
+
def _is_auto_datetime_field(field: Field) -> bool:
|
|
74
|
+
return getattr(field, "auto_now_add", False) or getattr(field, "auto_now", False)
|
|
75
|
+
|
|
76
|
+
|
|
73
77
|
def seed(seed: Union[int, float, str, bytes, bytearray, None]) -> None:
|
|
74
78
|
Baker.seed(seed)
|
|
75
79
|
|
|
@@ -513,10 +517,7 @@ class Baker(Generic[M]):
|
|
|
513
517
|
if isinstance(field, ForeignRelatedObjectsDescriptor):
|
|
514
518
|
one_to_many_keys[k] = attrs.pop(k)
|
|
515
519
|
|
|
516
|
-
if hasattr(field, "field") and (
|
|
517
|
-
getattr(field.field, "auto_now_add", False)
|
|
518
|
-
or getattr(field.field, "auto_now", False)
|
|
519
|
-
):
|
|
520
|
+
if hasattr(field, "field") and _is_auto_datetime_field(field.field):
|
|
520
521
|
auto_now_keys[k] = attrs[k]
|
|
521
522
|
|
|
522
523
|
if BAKER_CONTENTTYPES and isinstance(field, GenericForeignKey):
|
|
@@ -589,6 +590,9 @@ class Baker(Generic[M]):
|
|
|
589
590
|
else:
|
|
590
591
|
field.fill_optional = field.name in self.fill_in_optional
|
|
591
592
|
|
|
593
|
+
if _is_auto_datetime_field(field):
|
|
594
|
+
return True
|
|
595
|
+
|
|
592
596
|
if isinstance(field, FileField) and not self.create_files:
|
|
593
597
|
return True
|
|
594
598
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import collections
|
|
2
|
+
import copy
|
|
2
3
|
import itertools
|
|
3
4
|
from typing import (
|
|
4
5
|
Any,
|
|
@@ -79,6 +80,8 @@ class Recipe(Generic[M]):
|
|
|
79
80
|
mapping[k] = v.recipe.prepare(_using=_using, **recipe_attrs)
|
|
80
81
|
elif isinstance(v, related):
|
|
81
82
|
mapping[k] = v.make
|
|
83
|
+
elif isinstance(v, collections.abc.Container):
|
|
84
|
+
mapping[k] = copy.deepcopy(v)
|
|
82
85
|
|
|
83
86
|
mapping.update(new_attrs)
|
|
84
87
|
mapping.update(rel_fields_attrs)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.20.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|