How can I add in my custom class an option to a field existing in the parent model?
More concretely: I’m writing a custom comment model inheriting from django.contrib.comments.models.Comment.
I’d like to add the option editable = False to the IPAddressField.
thank you
I don’t know of a way to add an option to an existing field in a super class (if anyone knows better do share). You cannot override the field either as the superclass is not abstract.
If you only want to prevent the field from getting edited you can use a custom model form. This form can validate to make sure that the IP Address field cannot be edited.