3YOURMIND / django-deprecate-fields

This package allows deprecating model fields and allows removing them in a backwards compatible manner.
Apache License 2.0
176 stars 19 forks source link

Allow the usage of model instance data for callable return_instead #26

Closed Elkasitu closed 1 year ago

Elkasitu commented 1 year ago

With this commit, callables passed to return_instead can accept a single argument which will be the model instance on which the deprecated field is being accessed.

This allows django-deprecate-fields users to set the return value of the deprecated field to that of another field directly (aliasing) or to extrapolate what would have been the value based on one or more model instance attributes.