During work on updating Saleor's codebase to use current prices, I've ran into plenty of edge cases with Django ORM accessing different attributes on TaxedMoneyField instances when running different operations.
Those could've been found much sooner if our test suite included following scenarios:
model.save()
model.save(update_fields)
model.delete()
We should also explore how behavior of those changes for models that are:
pointed to by ForeignKey in other model
are pointing to other model via ForeignKey
This is because Django's ORM appears to look up related models fields, iterating on them and snooping out different attrs for its checks and validations.
During work on updating Saleor's codebase to use current prices, I've ran into plenty of edge cases with Django ORM accessing different attributes on
TaxedMoneyField
instances when running different operations.Those could've been found much sooner if our test suite included following scenarios:
model.save()
model.save(update_fields)
model.delete()
We should also explore how behavior of those changes for models that are:
ForeignKey
in other modelForeignKey
This is because Django's ORM appears to look up related models fields, iterating on them and snooping out different attrs for its checks and validations.