Django Inherited Field Access
- by Rick
As of the most current version, Django does not allow a subclass to have a variable with the same name as a variable in its superclass, if that variable is a Field instance.
I need a subclass to modify this variable, which I call 'department'. Calling my classes super and sub, I need sub to modify the department variable it inherits from super. If I redeclare it, Django throws a field error. Of course, if I don't, department is not in scope for reassignment. If super has no department I get database errors. I get weird behaviour when I try rewriting init:
def __init__(self):
super(theSuperClass, self).__init__()
TypeError: super(type, obj): obj must be an instance or subtype of type
Anyone have any idea how to do this?