model-bakery 1.19.4__tar.gz → 1.19.5__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.19.4 → model_bakery-1.19.5}/PKG-INFO +1 -1
- model_bakery-1.19.5/model_bakery/__about__.py +1 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/baker.py +17 -11
- model_bakery-1.19.4/model_bakery/__about__.py +0 -1
- {model_bakery-1.19.4 → model_bakery-1.19.5}/.gitignore +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/LICENSE +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/README.md +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/__init__.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/_types.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/content_types.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/exceptions.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/generators.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/gis.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/mock_file.txt +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/mock_img.jpeg +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/py.typed +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/random_gen.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/recipe.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/timezone.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/model_bakery/utils.py +0 -0
- {model_bakery-1.19.4 → model_bakery-1.19.5}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: model-bakery
|
|
3
|
-
Version: 1.19.
|
|
3
|
+
Version: 1.19.5
|
|
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.19.5"
|
|
@@ -695,21 +695,27 @@ class Baker(Generic[M]):
|
|
|
695
695
|
def _handle_generic_foreign_keys(self, instance: Model, attrs: Dict[str, Any]):
|
|
696
696
|
"""Set content type and object id for GenericForeignKey fields."""
|
|
697
697
|
for field_name, data in attrs.items():
|
|
698
|
-
|
|
699
|
-
|
|
698
|
+
ct_field_name = data["content_type_field"]
|
|
699
|
+
oid_field_name = data["object_id_field"]
|
|
700
700
|
value = data["value"]
|
|
701
701
|
if is_iterator(value):
|
|
702
702
|
value = next(value)
|
|
703
703
|
if value is None:
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
704
|
+
# when GFK is None, we should try to set the content type and object id to None
|
|
705
|
+
content_type_field = instance._meta.get_field(ct_field_name)
|
|
706
|
+
object_id_field = instance._meta.get_field(oid_field_name)
|
|
707
|
+
if content_type_field.null:
|
|
708
|
+
setattr(instance, ct_field_name, None)
|
|
709
|
+
if object_id_field.null:
|
|
710
|
+
setattr(instance, oid_field_name, None)
|
|
711
|
+
else:
|
|
712
|
+
setattr(instance, field_name, value)
|
|
713
|
+
setattr(
|
|
714
|
+
instance,
|
|
715
|
+
ct_field_name,
|
|
716
|
+
contenttypes_models.ContentType.objects.get_for_model(value),
|
|
717
|
+
)
|
|
718
|
+
setattr(instance, oid_field_name, value.pk)
|
|
713
719
|
|
|
714
720
|
def _remote_field(
|
|
715
721
|
self, field: Union[ForeignKey, OneToOneField]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.19.4"
|
|
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
|
|
File without changes
|