Closed pmg103 closed 4 years ago
Perhaps the key
should remain the name of the relation and the alias should provide the name of the key? Might simplify implementation.
Another thing to think about is how Aliased
and Filtered
interact. It's definitely likely to want to both alias AND filter. Simplest solution I suppose would be
{'sessions': AliasedFilterd('completed_sessions', Q(completed=True), [
'user',
'rater_for'
])},
But I feel like there might be a nicer way of composing these operations, leaving it open to extending with further ones in the future. But I can't actually think of one 😞
Sometimes a key may need to be aliased. One big reason is in case a Plugin needs to fetch the same key but with different filters/subspec and so that it doesn't clash with the enclosing spec. But you might also just want to alias a key for API purposes.
Something like this could do the trick: