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
It should be possible to have a relation field configured to "optionally" have relation ID, but allow e.g. other attributes. In practice, this means that the following should be a valid record:
classRecord(RecordBase):
relations=RelationsField(
licenses=PKListRelation(
'metadata.licenses',
record_cls=License,
# `True` would be the current behaviorrequired_relation=False
),
)
Record.create({
'metadata': {
'licenses': [
# Item with related object filled-in
{'id': 'mit'},
# Item without a related object filled-in, but with custom data
{'title': 'Foobar 3.0', 'description': 'The v3.0 of the Foobar license.'},
]
}
})
Extra
It might be interesting to also support a hybrid of both identifier and custom overrides for the item (e.g. {'id': 'mit', 'description': 'Custom license description'})
The text was updated successfully, but these errors were encountered:
slint
changed the title
relations: support "optional" relation fields
relations: support "optional" relation field values
Dec 14, 2020
It should be possible to have a relation field configured to "optionally" have relation ID, but allow e.g. other attributes. In practice, this means that the following should be a valid record:
Extra
It might be interesting to also support a hybrid of both identifier and custom overrides for the item (e.g.
{'id': 'mit', 'description': 'Custom license description'}
)The text was updated successfully, but these errors were encountered: