django-shop icon indicating copy to clipboard operation
django-shop copied to clipboard

Overriding decimalfield_kwargs on BaseOrder model has no effect

Open jab3z opened this issue 7 years ago • 3 comments

Changing the decimalfield_kwargs in subclass has no effect after the model has been materialized. I had this issue before and till django 1.7 was easy to override the field attributes of the superclass with a decorator or other python appropriate methods.

There is also this django ticket opened for the very same issue.

I'm stumbled into this issue and the only good exit I'm seeing now is to remove the decimal fields from superclass and add them into subclass.

Any other approaches?

jab3z avatar Aug 22 '16 18:08 jab3z

oh, haven't been aware of this. Well then we should move the decimalfield_kwargs into shop/settings.py, so that it becomes overridable. Do you have a better name for it?

jrief avatar Aug 22 '16 19:08 jrief

That will not solve the issue, because once the model becomes concrete, the field descriptors are not being overwritten even the arguments are changed.

What if we remove the decimal fields from shop models and explicitly ask to be added on subclassed models with desired properties?

jab3z avatar Aug 22 '16 20:08 jab3z

but if we can override those decimalfield_kwargs through settings.py, what's the point of making them overridable?

jrief avatar Aug 26 '16 20:08 jrief