Hi All,
Apologize if this question has been asked before. This is my first question into this mailing list.
I am creating a custom field(MyCustomField) with a custom value class(MyValue). I do have a deconstruct() method for my field class. And I would like to have a default value of this field.
class MyModel(models.Model):
myValue = MyCustomField(default = MyValue(args))
Based on the guide, I am supposed to be able to write a custom field using existing value class which I don't have access to the source. Quote below,
"In order to use the Hand
class in our models, we do not have to change this class at all. This is ideal, because it means you can easily write model support for existing classes where you cannot change the source code."
So is giving a deconstruct() method and probably a __eq__() method violate this principle? I know I can subclass the existing class. But is it what I supposed to do? I just want to make sure my understanding is correct and what is the right design rule here?
Thanks
--