-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GenericForeignKey
not accounted for in baker._skip_field()
#416
Comments
We also have this problem, and are currently pinned to version <1.3 because of it. Would a patch containing the above change be acceptable? What else would be needed? Thanks in advance! |
Greetings, and sorry for the radio silence! I'd happily accept the patch with the test (if possible). Otherwise, I could tackle this some time at the beginning of the next month. |
Rust, Many thanks for your quick response. Paul |
@paduszyk @paulredman- I got a bit of time to dig into this issue. For example, there is a test After playing around a bit, I have some kind of a workaround to cover the case described here: #438 While this solution works, I do not think it is the right way of solving this and would need to dig more. |
A bugfix for this was released in 1.18.3. |
* origin/main: Bump 1.19.0 Fix #483 -- Add Django 5.1 support (#485) Bump 1.18.3 Refs #416 -- Allow combination of GFK and `_fill_optional` (#438) Bump 1.18.2 Update ruff CI syntax (#481) Fix #28 -- allow make_recipe to work with _quantity (#480) Bump 1.18.1 Replace expensive `count()` with cheap `exists()` (#478) Update CI Python version to 3.12 Delete hard action requirement for a changelog Bump 1.18.0 Fix #265 -- drop hard dependency on `contenttypes` framework (#476) Bump GitHub Actions artifacts to v4 (#470) Drop Django 3.2 support (#475) Bump actions/setup-python from 4 to 5 (#466) Drop Django 4.1 support (reached end of life) (#465) Support Django 5.0 (#464)
When trying to bake a model with mandatory generic relation and set
_fill_optional=True
at the same time, I getAttributeError
due to invalid reference to generic FK field'snull
attribute.If I add
GenericForeignKey
to the tuple ref. below (followed by its import, of course), the problem disappears.model_bakery/model_bakery/baker.py
Line 571 in 75735ff
I guess the problem is that generic FK is identified as nullable, thus optional... Anyone can explain why this has not been done yet?
The text was updated successfully, but these errors were encountered: