You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, to change the default value of a field (such as display_name), a block needs to copy the definition. This means that if other values in the field need to change, they need to be changed in many places, which is subpar.
The text was updated successfully, but these errors were encountered:
When this happens, accidentally overriding a field should raise an exception.
Proposal:
class FooBlock(XBlock):
display_name = OverrideField(default='Foo Block') # Uses the same field definition as the parent, with kwargs overridden
tags = Field(...) # raises an exception, because it hides a parent field
name = OverrideField(scope=scope.user_state) # Error, can't override the scope
How often has a subclass wanted to keep a field but change its default? This seems like an odd operation to me. There must be some real examples we can look at, I know you didn't invent this for the fun of it.
Currently, to change the default value of a field (such as display_name), a block needs to copy the definition. This means that if other values in the field need to change, they need to be changed in many places, which is subpar.
The text was updated successfully, but these errors were encountered: