Closed dannyshaw closed 6 years ago
Merging #63 into master will increase coverage by
1%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #63 +/- ##
=======================================
+ Coverage 63.84% 64.85% +1%
=======================================
Files 12 12
Lines 780 791 +11
=======================================
+ Hits 498 513 +15
+ Misses 282 278 -4
Impacted Files | Coverage Δ | |
---|---|---|
polymorphic_tree/tests/test_models.py | 100% <100%> (ø) |
:arrow_up: |
polymorphic_tree/models.py | 63.79% <100%> (+3.79%) |
:arrow_up: |
polymorphic_tree/tests/models.py | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 6aaff56...b06fa21. Read the comment docs.
That is a great improvement, thanks!
This PR introduces the ability to validate a child type against the parent prior to the child being saved in the database.
With restricted
child_types
set, django admin would not allow you to add a valid child type because it tries to validate the object before creating it in the db and thepolymorphic_ctype_id
is not set to be able to answer the question.This change simply calls the available
pre_save_polymorphic()
method to set the id in memory prior to the check.Test added to expose issue.